1 | /****************************************************************************
|
---|
2 | ** $Id: qxml.h,v 1.1 2004/02/29 00:05:06 justin Exp $
|
---|
3 | **
|
---|
4 | ** Definition of QXmlSimpleReader and related classes.
|
---|
5 | **
|
---|
6 | ** Created : 000518
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the xml module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this
|
---|
22 | ** file in accordance with the Qt Commercial License Agreement provided
|
---|
23 | ** with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #ifndef QXML_H
|
---|
39 | #define QXML_H
|
---|
40 |
|
---|
41 | #ifndef QT_H
|
---|
42 | #include "qtextstream.h"
|
---|
43 | #include "qfile.h"
|
---|
44 | #include "qstring.h"
|
---|
45 | #include "qstringlist.h"
|
---|
46 | #endif // QT_H
|
---|
47 |
|
---|
48 | #if !defined(QT_MODULE_XML) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_XML )
|
---|
49 | #define QM_EXPORT_XML
|
---|
50 | #else
|
---|
51 | #define QM_EXPORT_XML Q_EXPORT
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #ifndef QT_NO_XML
|
---|
55 |
|
---|
56 | namespace PsiXml {
|
---|
57 |
|
---|
58 | class QXmlNamespaceSupport;
|
---|
59 | class QXmlAttributes;
|
---|
60 | class QXmlContentHandler;
|
---|
61 | class QXmlDefaultHandler;
|
---|
62 | class QXmlDTDHandler;
|
---|
63 | class QXmlEntityResolver;
|
---|
64 | class QXmlErrorHandler;
|
---|
65 | class QXmlLexicalHandler;
|
---|
66 | class QXmlDeclHandler;
|
---|
67 | class QXmlInputSource;
|
---|
68 | class QXmlLocator;
|
---|
69 | class QXmlNamespaceSupport;
|
---|
70 | class QXmlParseException;
|
---|
71 |
|
---|
72 | class QXmlReader;
|
---|
73 | class QXmlSimpleReader;
|
---|
74 |
|
---|
75 | class QXmlSimpleReaderPrivate;
|
---|
76 | class QXmlNamespaceSupportPrivate;
|
---|
77 | class QXmlAttributesPrivate;
|
---|
78 | class QXmlInputSourcePrivate;
|
---|
79 | class QXmlParseExceptionPrivate;
|
---|
80 | class QXmlLocatorPrivate;
|
---|
81 | class QXmlDefaultHandlerPrivate;
|
---|
82 |
|
---|
83 |
|
---|
84 | //
|
---|
85 | // SAX Namespace Support
|
---|
86 | //
|
---|
87 |
|
---|
88 | class QM_EXPORT_XML QXmlNamespaceSupport
|
---|
89 | {
|
---|
90 | public:
|
---|
91 | QXmlNamespaceSupport();
|
---|
92 | ~QXmlNamespaceSupport();
|
---|
93 |
|
---|
94 | void setPrefix( const QString&, const QString& );
|
---|
95 |
|
---|
96 | QString prefix( const QString& ) const;
|
---|
97 | QString uri( const QString& ) const;
|
---|
98 | void splitName( const QString&, QString&, QString& ) const;
|
---|
99 | void processName( const QString&, bool, QString&, QString& ) const;
|
---|
100 | QStringList prefixes() const;
|
---|
101 | QStringList prefixes( const QString& ) const;
|
---|
102 |
|
---|
103 | void pushContext();
|
---|
104 | void popContext();
|
---|
105 | void reset();
|
---|
106 |
|
---|
107 | private:
|
---|
108 | QXmlNamespaceSupportPrivate *d;
|
---|
109 | };
|
---|
110 |
|
---|
111 |
|
---|
112 | //
|
---|
113 | // SAX Attributes
|
---|
114 | //
|
---|
115 |
|
---|
116 | class QM_EXPORT_XML QXmlAttributes
|
---|
117 | {
|
---|
118 | public:
|
---|
119 | QXmlAttributes() {}
|
---|
120 | virtual ~QXmlAttributes() {}
|
---|
121 |
|
---|
122 | int index( const QString& qName ) const;
|
---|
123 | int index( const QString& uri, const QString& localPart ) const;
|
---|
124 | int length() const;
|
---|
125 | int count() const;
|
---|
126 | QString localName( int index ) const;
|
---|
127 | QString qName( int index ) const;
|
---|
128 | QString uri( int index ) const;
|
---|
129 | QString type( int index ) const;
|
---|
130 | QString type( const QString& qName ) const;
|
---|
131 | QString type( const QString& uri, const QString& localName ) const;
|
---|
132 | QString value( int index ) const;
|
---|
133 | QString value( const QString& qName ) const;
|
---|
134 | QString value( const QString& uri, const QString& localName ) const;
|
---|
135 |
|
---|
136 | void clear();
|
---|
137 | void append( const QString &qName, const QString &uri, const QString &localPart, const QString &value );
|
---|
138 |
|
---|
139 | private:
|
---|
140 | QStringList qnameList;
|
---|
141 | QStringList uriList;
|
---|
142 | QStringList localnameList;
|
---|
143 | QStringList valueList;
|
---|
144 |
|
---|
145 | QXmlAttributesPrivate *d;
|
---|
146 | };
|
---|
147 |
|
---|
148 | //
|
---|
149 | // SAX Input Source
|
---|
150 | //
|
---|
151 |
|
---|
152 | class QM_EXPORT_XML QXmlInputSource
|
---|
153 | {
|
---|
154 | public:
|
---|
155 | QXmlInputSource();
|
---|
156 | QXmlInputSource( QIODevice *dev );
|
---|
157 | QXmlInputSource( QFile& file ); // obsolete
|
---|
158 | QXmlInputSource( QTextStream& stream ); // obsolete
|
---|
159 | virtual ~QXmlInputSource();
|
---|
160 |
|
---|
161 | virtual void setData( const QString& dat );
|
---|
162 | virtual void setData( const QByteArray& dat );
|
---|
163 | virtual void fetchData();
|
---|
164 | virtual QString data();
|
---|
165 | virtual QChar next();
|
---|
166 | virtual void reset();
|
---|
167 |
|
---|
168 | static const QChar EndOfData;
|
---|
169 | static const QChar EndOfDocument;
|
---|
170 |
|
---|
171 | protected:
|
---|
172 | virtual QString fromRawData( const QByteArray &data, bool beginning = FALSE );
|
---|
173 |
|
---|
174 | private:
|
---|
175 | void init();
|
---|
176 |
|
---|
177 | QIODevice *inputDevice;
|
---|
178 | QTextStream *inputStream;
|
---|
179 |
|
---|
180 | QString str;
|
---|
181 | const QChar *unicode;
|
---|
182 | int pos;
|
---|
183 | int length;
|
---|
184 | bool nextReturnedEndOfData;
|
---|
185 | QTextDecoder *encMapper;
|
---|
186 |
|
---|
187 | QXmlInputSourcePrivate *d;
|
---|
188 | };
|
---|
189 |
|
---|
190 | //
|
---|
191 | // SAX Exception Classes
|
---|
192 | //
|
---|
193 |
|
---|
194 | class QM_EXPORT_XML QXmlParseException
|
---|
195 | {
|
---|
196 | public:
|
---|
197 | QXmlParseException( const QString& name="", int c=-1, int l=-1, const QString& p="", const QString& s="" )
|
---|
198 | : msg( name ), column( c ), line( l ), pub( p ), sys( s )
|
---|
199 | { }
|
---|
200 |
|
---|
201 | int columnNumber() const;
|
---|
202 | int lineNumber() const;
|
---|
203 | QString publicId() const;
|
---|
204 | QString systemId() const;
|
---|
205 | QString message() const;
|
---|
206 |
|
---|
207 | private:
|
---|
208 | QString msg;
|
---|
209 | int column;
|
---|
210 | int line;
|
---|
211 | QString pub;
|
---|
212 | QString sys;
|
---|
213 |
|
---|
214 | QXmlParseExceptionPrivate *d;
|
---|
215 | };
|
---|
216 |
|
---|
217 |
|
---|
218 | //
|
---|
219 | // XML Reader
|
---|
220 | //
|
---|
221 |
|
---|
222 | class QM_EXPORT_XML QXmlReader
|
---|
223 | {
|
---|
224 | public:
|
---|
225 | virtual bool feature( const QString& name, bool *ok = 0 ) const = 0;
|
---|
226 | virtual void setFeature( const QString& name, bool value ) = 0;
|
---|
227 | virtual bool hasFeature( const QString& name ) const = 0;
|
---|
228 | virtual void* property( const QString& name, bool *ok = 0 ) const = 0;
|
---|
229 | virtual void setProperty( const QString& name, void* value ) = 0;
|
---|
230 | virtual bool hasProperty( const QString& name ) const = 0;
|
---|
231 | virtual void setEntityResolver( QXmlEntityResolver* handler ) = 0;
|
---|
232 | virtual QXmlEntityResolver* entityResolver() const = 0;
|
---|
233 | virtual void setDTDHandler( QXmlDTDHandler* handler ) = 0;
|
---|
234 | virtual QXmlDTDHandler* DTDHandler() const = 0;
|
---|
235 | virtual void setContentHandler( QXmlContentHandler* handler ) = 0;
|
---|
236 | virtual QXmlContentHandler* contentHandler() const = 0;
|
---|
237 | virtual void setErrorHandler( QXmlErrorHandler* handler ) = 0;
|
---|
238 | virtual QXmlErrorHandler* errorHandler() const = 0;
|
---|
239 | virtual void setLexicalHandler( QXmlLexicalHandler* handler ) = 0;
|
---|
240 | virtual QXmlLexicalHandler* lexicalHandler() const = 0;
|
---|
241 | virtual void setDeclHandler( QXmlDeclHandler* handler ) = 0;
|
---|
242 | virtual QXmlDeclHandler* declHandler() const = 0;
|
---|
243 | virtual bool parse( const QXmlInputSource& input ) = 0;
|
---|
244 | virtual bool parse( const QXmlInputSource* input ) = 0;
|
---|
245 | };
|
---|
246 |
|
---|
247 | class QM_EXPORT_XML QXmlSimpleReader : public QXmlReader
|
---|
248 | {
|
---|
249 | public:
|
---|
250 | QXmlSimpleReader();
|
---|
251 | virtual ~QXmlSimpleReader();
|
---|
252 |
|
---|
253 | bool feature( const QString& name, bool *ok = 0 ) const;
|
---|
254 | void setFeature( const QString& name, bool value );
|
---|
255 | bool hasFeature( const QString& name ) const;
|
---|
256 |
|
---|
257 | void* property( const QString& name, bool *ok = 0 ) const;
|
---|
258 | void setProperty( const QString& name, void* value );
|
---|
259 | bool hasProperty( const QString& name ) const;
|
---|
260 |
|
---|
261 | void setEntityResolver( QXmlEntityResolver* handler );
|
---|
262 | QXmlEntityResolver* entityResolver() const;
|
---|
263 | void setDTDHandler( QXmlDTDHandler* handler );
|
---|
264 | QXmlDTDHandler* DTDHandler() const;
|
---|
265 | void setContentHandler( QXmlContentHandler* handler );
|
---|
266 | QXmlContentHandler* contentHandler() const;
|
---|
267 | void setErrorHandler( QXmlErrorHandler* handler );
|
---|
268 | QXmlErrorHandler* errorHandler() const;
|
---|
269 | void setLexicalHandler( QXmlLexicalHandler* handler );
|
---|
270 | QXmlLexicalHandler* lexicalHandler() const;
|
---|
271 | void setDeclHandler( QXmlDeclHandler* handler );
|
---|
272 | QXmlDeclHandler* declHandler() const;
|
---|
273 |
|
---|
274 | bool parse( const QXmlInputSource& input );
|
---|
275 | bool parse( const QXmlInputSource* input );
|
---|
276 | virtual bool parse( const QXmlInputSource* input, bool incremental );
|
---|
277 | virtual bool parseContinue();
|
---|
278 |
|
---|
279 | private:
|
---|
280 | // variables
|
---|
281 | QXmlContentHandler *contentHnd;
|
---|
282 | QXmlErrorHandler *errorHnd;
|
---|
283 | QXmlDTDHandler *dtdHnd;
|
---|
284 | QXmlEntityResolver *entityRes;
|
---|
285 | QXmlLexicalHandler *lexicalHnd;
|
---|
286 | QXmlDeclHandler *declHnd;
|
---|
287 |
|
---|
288 | QXmlInputSource *inputSource;
|
---|
289 |
|
---|
290 | QChar c; // the character at reading position
|
---|
291 | int lineNr; // number of line
|
---|
292 | int columnNr; // position in line
|
---|
293 |
|
---|
294 | int namePos;
|
---|
295 | QChar nameArray[256]; // only used for names
|
---|
296 | QString nameValue; // only used for names
|
---|
297 | int refPos;
|
---|
298 | QChar refArray[256]; // only used for references
|
---|
299 | QString refValue; // only used for references
|
---|
300 | int stringPos;
|
---|
301 | QChar stringArray[256]; // used for any other strings that are parsed
|
---|
302 | QString stringValue; // used for any other strings that are parsed
|
---|
303 |
|
---|
304 | QXmlSimpleReaderPrivate* d;
|
---|
305 |
|
---|
306 | // inlines
|
---|
307 | bool is_S( const QChar& );
|
---|
308 | bool is_NameBeginning( const QChar& );
|
---|
309 | bool is_NameChar( const QChar& );
|
---|
310 |
|
---|
311 | QString& string();
|
---|
312 | void stringClear();
|
---|
313 | void stringAddC();
|
---|
314 | void stringAddC(const QChar&);
|
---|
315 | QString& name();
|
---|
316 | void nameClear();
|
---|
317 | void nameAddC();
|
---|
318 | void nameAddC(const QChar&);
|
---|
319 | QString& ref();
|
---|
320 | void refClear();
|
---|
321 | void refAddC();
|
---|
322 | void refAddC(const QChar&);
|
---|
323 |
|
---|
324 | // used by parseReference() and parsePEReference()
|
---|
325 | enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD };
|
---|
326 |
|
---|
327 | // private functions
|
---|
328 | bool eat_ws();
|
---|
329 | bool next_eat_ws();
|
---|
330 |
|
---|
331 | void next();
|
---|
332 | bool atEnd();
|
---|
333 |
|
---|
334 | void init( const QXmlInputSource* i );
|
---|
335 | void initData();
|
---|
336 |
|
---|
337 | bool entityExist( const QString& ) const;
|
---|
338 |
|
---|
339 | bool parseBeginOrContinue( int state, bool incremental );
|
---|
340 |
|
---|
341 | bool parseProlog();
|
---|
342 | bool parseElement();
|
---|
343 | bool processElementEmptyTag();
|
---|
344 | bool processElementETagBegin2();
|
---|
345 | bool processElementAttribute();
|
---|
346 | bool parseMisc();
|
---|
347 | bool parseContent();
|
---|
348 |
|
---|
349 | bool parsePI();
|
---|
350 | bool parseDoctype();
|
---|
351 | bool parseComment();
|
---|
352 |
|
---|
353 | bool parseName();
|
---|
354 | bool parseNmtoken();
|
---|
355 | bool parseAttribute();
|
---|
356 | bool parseReference();
|
---|
357 | bool processReference();
|
---|
358 |
|
---|
359 | bool parseExternalID();
|
---|
360 | bool parsePEReference();
|
---|
361 | bool parseMarkupdecl();
|
---|
362 | bool parseAttlistDecl();
|
---|
363 | bool parseAttType();
|
---|
364 | bool parseAttValue();
|
---|
365 | bool parseElementDecl();
|
---|
366 | bool parseNotationDecl();
|
---|
367 | bool parseChoiceSeq();
|
---|
368 | bool parseEntityDecl();
|
---|
369 | bool parseEntityValue();
|
---|
370 |
|
---|
371 | bool parseString();
|
---|
372 |
|
---|
373 | bool insertXmlRef( const QString&, const QString&, bool );
|
---|
374 |
|
---|
375 | bool reportEndEntities();
|
---|
376 | void reportParseError( const QString& error );
|
---|
377 |
|
---|
378 | typedef bool (QXmlSimpleReader::*ParseFunction) ();
|
---|
379 | void unexpectedEof( ParseFunction where, int state );
|
---|
380 | void parseFailed( ParseFunction where, int state );
|
---|
381 | void pushParseState( ParseFunction function, int state );
|
---|
382 |
|
---|
383 | friend class QXmlSimpleReaderPrivate;
|
---|
384 | friend class QXmlSimpleReaderLocator;
|
---|
385 | };
|
---|
386 |
|
---|
387 | //
|
---|
388 | // SAX Locator
|
---|
389 | //
|
---|
390 |
|
---|
391 | class QM_EXPORT_XML QXmlLocator
|
---|
392 | {
|
---|
393 | public:
|
---|
394 | QXmlLocator();
|
---|
395 | virtual ~QXmlLocator();
|
---|
396 |
|
---|
397 | virtual int columnNumber() = 0;
|
---|
398 | virtual int lineNumber() = 0;
|
---|
399 | // QString getPublicId()
|
---|
400 | // QString getSystemId()
|
---|
401 | };
|
---|
402 |
|
---|
403 | //
|
---|
404 | // SAX handler classes
|
---|
405 | //
|
---|
406 |
|
---|
407 | class QM_EXPORT_XML QXmlContentHandler
|
---|
408 | {
|
---|
409 | public:
|
---|
410 | virtual void setDocumentLocator( QXmlLocator* locator ) = 0;
|
---|
411 | virtual bool startDocument() = 0;
|
---|
412 | virtual bool endDocument() = 0;
|
---|
413 | virtual bool startPrefixMapping( const QString& prefix, const QString& uri ) = 0;
|
---|
414 | virtual bool endPrefixMapping( const QString& prefix ) = 0;
|
---|
415 | virtual bool startElement( const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts ) = 0;
|
---|
416 | virtual bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName ) = 0;
|
---|
417 | virtual bool characters( const QString& ch ) = 0;
|
---|
418 | virtual bool ignorableWhitespace( const QString& ch ) = 0;
|
---|
419 | virtual bool processingInstruction( const QString& target, const QString& data ) = 0;
|
---|
420 | virtual bool skippedEntity( const QString& name ) = 0;
|
---|
421 | virtual QString errorString() = 0;
|
---|
422 | };
|
---|
423 |
|
---|
424 | class QM_EXPORT_XML QXmlErrorHandler
|
---|
425 | {
|
---|
426 | public:
|
---|
427 | virtual bool warning( const QXmlParseException& exception ) = 0;
|
---|
428 | virtual bool error( const QXmlParseException& exception ) = 0;
|
---|
429 | virtual bool fatalError( const QXmlParseException& exception ) = 0;
|
---|
430 | virtual QString errorString() = 0;
|
---|
431 | };
|
---|
432 |
|
---|
433 | class QM_EXPORT_XML QXmlDTDHandler
|
---|
434 | {
|
---|
435 | public:
|
---|
436 | virtual bool notationDecl( const QString& name, const QString& publicId, const QString& systemId ) = 0;
|
---|
437 | virtual bool unparsedEntityDecl( const QString& name, const QString& publicId, const QString& systemId, const QString& notationName ) = 0;
|
---|
438 | virtual QString errorString() = 0;
|
---|
439 | };
|
---|
440 |
|
---|
441 | class QM_EXPORT_XML QXmlEntityResolver
|
---|
442 | {
|
---|
443 | public:
|
---|
444 | virtual bool resolveEntity( const QString& publicId, const QString& systemId, QXmlInputSource*& ret ) = 0;
|
---|
445 | virtual QString errorString() = 0;
|
---|
446 | };
|
---|
447 |
|
---|
448 | class QM_EXPORT_XML QXmlLexicalHandler
|
---|
449 | {
|
---|
450 | public:
|
---|
451 | virtual bool startDTD( const QString& name, const QString& publicId, const QString& systemId ) = 0;
|
---|
452 | virtual bool endDTD() = 0;
|
---|
453 | virtual bool startEntity( const QString& name ) = 0;
|
---|
454 | virtual bool endEntity( const QString& name ) = 0;
|
---|
455 | virtual bool startCDATA() = 0;
|
---|
456 | virtual bool endCDATA() = 0;
|
---|
457 | virtual bool comment( const QString& ch ) = 0;
|
---|
458 | virtual QString errorString() = 0;
|
---|
459 | };
|
---|
460 |
|
---|
461 | class QM_EXPORT_XML QXmlDeclHandler
|
---|
462 | {
|
---|
463 | public:
|
---|
464 | virtual bool attributeDecl( const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value ) = 0;
|
---|
465 | virtual bool internalEntityDecl( const QString& name, const QString& value ) = 0;
|
---|
466 | virtual bool externalEntityDecl( const QString& name, const QString& publicId, const QString& systemId ) = 0;
|
---|
467 | virtual QString errorString() = 0;
|
---|
468 | };
|
---|
469 |
|
---|
470 |
|
---|
471 | class QM_EXPORT_XML QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler
|
---|
472 | {
|
---|
473 | public:
|
---|
474 | QXmlDefaultHandler() { }
|
---|
475 | virtual ~QXmlDefaultHandler() { }
|
---|
476 |
|
---|
477 | void setDocumentLocator( QXmlLocator* locator );
|
---|
478 | bool startDocument();
|
---|
479 | bool endDocument();
|
---|
480 | bool startPrefixMapping( const QString& prefix, const QString& uri );
|
---|
481 | bool endPrefixMapping( const QString& prefix );
|
---|
482 | bool startElement( const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts );
|
---|
483 | bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName );
|
---|
484 | bool characters( const QString& ch );
|
---|
485 | bool ignorableWhitespace( const QString& ch );
|
---|
486 | bool processingInstruction( const QString& target, const QString& data );
|
---|
487 | bool skippedEntity( const QString& name );
|
---|
488 |
|
---|
489 | bool warning( const QXmlParseException& exception );
|
---|
490 | bool error( const QXmlParseException& exception );
|
---|
491 | bool fatalError( const QXmlParseException& exception );
|
---|
492 |
|
---|
493 | bool notationDecl( const QString& name, const QString& publicId, const QString& systemId );
|
---|
494 | bool unparsedEntityDecl( const QString& name, const QString& publicId, const QString& systemId, const QString& notationName );
|
---|
495 |
|
---|
496 | bool resolveEntity( const QString& publicId, const QString& systemId, QXmlInputSource*& ret );
|
---|
497 |
|
---|
498 | bool startDTD( const QString& name, const QString& publicId, const QString& systemId );
|
---|
499 | bool endDTD();
|
---|
500 | bool startEntity( const QString& name );
|
---|
501 | bool endEntity( const QString& name );
|
---|
502 | bool startCDATA();
|
---|
503 | bool endCDATA();
|
---|
504 | bool comment( const QString& ch );
|
---|
505 |
|
---|
506 | bool attributeDecl( const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value );
|
---|
507 | bool internalEntityDecl( const QString& name, const QString& value );
|
---|
508 | bool externalEntityDecl( const QString& name, const QString& publicId, const QString& systemId );
|
---|
509 |
|
---|
510 | QString errorString();
|
---|
511 |
|
---|
512 | private:
|
---|
513 | QXmlDefaultHandlerPrivate *d;
|
---|
514 | };
|
---|
515 |
|
---|
516 |
|
---|
517 | //
|
---|
518 | // inlines
|
---|
519 | //
|
---|
520 |
|
---|
521 | inline bool QXmlSimpleReader::is_S(const QChar& ch)
|
---|
522 | {
|
---|
523 | return ch==' ' || ch=='\t' || ch=='\n' || ch=='\r';
|
---|
524 | }
|
---|
525 | inline bool QXmlSimpleReader::is_NameBeginning( const QChar& ch )
|
---|
526 | {
|
---|
527 | return ch=='_' || ch==':' ||
|
---|
528 | ch.isLetter() || // ### Category Lm is not allowed
|
---|
529 | ch.category()==QChar::Number_Letter;
|
---|
530 | }
|
---|
531 | inline bool QXmlSimpleReader::is_NameChar( const QChar& ch )
|
---|
532 | {
|
---|
533 | return ch=='.' || ch=='-' || ch=='_' || ch==':' ||
|
---|
534 | ch.isLetterOrNumber() || // ### Category No is not allowed
|
---|
535 | ch.isMark();
|
---|
536 | }
|
---|
537 |
|
---|
538 | inline bool QXmlSimpleReader::atEnd()
|
---|
539 | { return (c.unicode()|0x0001) == 0xffff; }
|
---|
540 |
|
---|
541 | inline void QXmlSimpleReader::stringClear()
|
---|
542 | { stringValue = QString::null; stringPos = 0; }
|
---|
543 | inline void QXmlSimpleReader::nameClear()
|
---|
544 | { nameValue = QString::null; namePos = 0; }
|
---|
545 | inline void QXmlSimpleReader::refClear()
|
---|
546 | { refValue = QString::null; refPos = 0; }
|
---|
547 |
|
---|
548 | inline int QXmlAttributes::count() const
|
---|
549 | { return length(); }
|
---|
550 |
|
---|
551 | } // namespace PsiXml
|
---|
552 |
|
---|
553 | using namespace PsiXml;
|
---|
554 |
|
---|
555 | #endif //QT_NO_XML
|
---|
556 |
|
---|
557 | #endif
|
---|