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