summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-10 10:11:10 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-10 10:11:11 +0200
commitf035786021e9f7b1d9512b22774bc15553caaedb (patch)
treec46a29ed3657944d9f36d8643a99fad469235bc4 /src/xml
parent72024fd50cdead8d890886dba32fd81ac54ff3ae (diff)
parent916c9d469bd0df227dc3be97fcca27e3cf58144f (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/doc/qtxml.qdocconf4
-rw-r--r--src/xml/dom/qdom.cpp23
-rw-r--r--src/xml/sax/qxml.cpp260
-rw-r--r--src/xml/sax/qxml.h1
-rw-r--r--src/xml/sax/qxml_p.h308
5 files changed, 330 insertions, 266 deletions
diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf
index f36848b566..ab10818522 100644
--- a/src/xml/doc/qtxml.qdocconf
+++ b/src/xml/doc/qtxml.qdocconf
@@ -30,11 +30,9 @@ depends += qtcore qtnetwork qtdoc
headerdirs += ..
-sourcedirs += .. \
- ../../../examples/xml/doc/src
+sourcedirs += ..
exampledirs += ../../../examples/xml \
- ../ \
snippets
imagedirs += images \
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 2383bda1c9..5907a72bd6 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -54,6 +54,7 @@
#include <qtextcodec.h>
#include <qtextstream.h>
#include <qxml.h>
+#include "private/qxml_p.h"
#include <qvariant.h>
#include <qmap.h>
#include <qshareddata.h>
@@ -502,7 +503,7 @@ public:
~QDomDocumentPrivate();
bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn);
- bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn);
+ bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn);
// Attributes
QDomDocumentTypePrivate* doctype() { return type.data(); }
@@ -573,7 +574,7 @@ public:
class QDomHandler : public QXmlDefaultHandler
{
public:
- QDomHandler(QDomDocumentPrivate* d, bool namespaceProcessing);
+ QDomHandler(QDomDocumentPrivate* d, QXmlSimpleReader *reader, bool namespaceProcessing);
~QDomHandler();
// content handler
@@ -615,6 +616,7 @@ private:
bool cdata;
bool nsProcessing;
QXmlLocator *locator;
+ QXmlSimpleReader *reader;
};
/**************************************************************
@@ -6208,10 +6210,10 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, bool namespaceProc
{
QXmlSimpleReader reader;
initializeReader(reader, namespaceProcessing);
- return setContent(source, &reader, errorMsg, errorLine, errorColumn);
+ return setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn);
}
-bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn)
+bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn)
{
clear();
impl = new QDomImplementationPrivate;
@@ -6221,7 +6223,7 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader
bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces"))
&& !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"));
- QDomHandler hnd(this, namespaceProcessing);
+ QDomHandler hnd(this, simpleReader, namespaceProcessing);
reader->setContentHandler(&hnd);
reader->setErrorHandler(&hnd);
reader->setLexicalHandler(&hnd);
@@ -6758,7 +6760,7 @@ bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing,
impl = new QDomDocumentPrivate();
QXmlSimpleReader reader;
initializeReader(reader, namespaceProcessing);
- return IMPL->setContent(source, &reader, errorMsg, errorLine, errorColumn);
+ return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn);
}
/*!
@@ -6820,7 +6822,7 @@ bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QStri
{
if (!impl)
impl = new QDomDocumentPrivate();
- return IMPL->setContent(source, reader, errorMsg, errorLine, errorColumn);
+ return IMPL->setContent(source, reader, 0, errorMsg, errorLine, errorColumn);
}
/*!
@@ -7360,9 +7362,9 @@ QDomComment QDomNode::toComment() const
*
**************************************************************/
-QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, bool namespaceProcessing)
+QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, QXmlSimpleReader* areader, bool namespaceProcessing)
: errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false),
- nsProcessing(namespaceProcessing), locator(0)
+ nsProcessing(namespaceProcessing), locator(0), reader(areader)
{
}
@@ -7466,11 +7468,10 @@ bool QDomHandler::processingInstruction(const QString& target, const QString& da
return false;
}
-extern bool qt_xml_skipped_entity_in_content;
bool QDomHandler::skippedEntity(const QString& name)
{
// we can only handle inserting entity references into content
- if (!qt_xml_skipped_entity_in_content)
+ if (reader && !reader->d_ptr->skipped_entity_in_content)
return true;
QDomNodePrivate *n = doc->createEntityReference(name);
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 9d91ce42a5..50900c17f0 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qxml.h"
+#include "qxml_p.h"
#include "qtextcodec.h"
#include "qbuffer.h"
#include "qregexp.h"
@@ -99,10 +100,6 @@ static const signed char cltDq = 12; // "
static const signed char cltSq = 13; // '
static const signed char cltUnknown = 14;
-// Hack for letting QDom know where the skipped entity occurred
-// ### the use of this variable means the code isn't reentrant.
-bool qt_xml_skipped_entity_in_content;
-
// character lookup table
static const signed char charLookupTable[256]={
cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x00 - 0x07
@@ -271,247 +268,6 @@ class QXmlDefaultHandlerPrivate
{
};
-class QXmlSimpleReaderPrivate
-{
-public:
- ~QXmlSimpleReaderPrivate();
-private:
- // functions
- QXmlSimpleReaderPrivate(QXmlSimpleReader *reader);
- void initIncrementalParsing();
-
- // used to determine if elements are correctly nested
- QStack<QString> tags;
-
- // used by parseReference() and parsePEReference()
- enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD };
-
- // used for entity declarations
- struct ExternParameterEntity
- {
- ExternParameterEntity() {}
- ExternParameterEntity(const QString &p, const QString &s)
- : publicId(p), systemId(s) {}
- QString publicId;
- QString systemId;
-
- Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity)
- };
- struct ExternEntity
- {
- ExternEntity() {}
- ExternEntity(const QString &p, const QString &s, const QString &n)
- : publicId(p), systemId(s), notation(n) {}
- QString publicId;
- QString systemId;
- QString notation;
- Q_DUMMY_COMPARISON_OPERATOR(ExternEntity)
- };
- QMap<QString,ExternParameterEntity> externParameterEntities;
- QMap<QString,QString> parameterEntities;
- QMap<QString,ExternEntity> externEntities;
- QMap<QString,QString> entities;
-
- // used for parsing of entity references
- struct XmlRef {
- XmlRef()
- : index(0) {}
- XmlRef(const QString &_name, const QString &_value)
- : name(_name), value(_value), index(0) {}
- bool isEmpty() const { return index == value.length(); }
- QChar next() { return value.at(index++); }
- QString name;
- QString value;
- int index;
- };
- QStack<XmlRef> xmlRefStack;
-
- // used for standalone declaration
- enum Standalone { Yes, No, Unknown };
-
- QString doctype; // only used for the doctype
- QString xmlVersion; // only used to store the version information
- QString encoding; // only used to store the encoding
- Standalone standalone; // used to store the value of the standalone declaration
-
- QString publicId; // used by parseExternalID() to store the public ID
- QString systemId; // used by parseExternalID() to store the system ID
-
- // Since publicId/systemId is used as temporary variables by parseExternalID(), it
- // might overwrite the PUBLIC/SYSTEM for the document we're parsing. In effect, we would
- // possibly send off an QXmlParseException that has the PUBLIC/SYSTEM of a entity declaration
- // instead of those of the current document.
- // Hence we have these two variables for storing the document's data.
- QString thisPublicId;
- QString thisSystemId;
-
- QString attDeclEName; // use by parseAttlistDecl()
- QString attDeclAName; // use by parseAttlistDecl()
-
- // flags for some features support
- bool useNamespaces;
- bool useNamespacePrefixes;
- bool reportWhitespaceCharData;
- bool reportEntities;
-
- // used to build the attribute list
- QXmlAttributes attList;
-
- // used in QXmlSimpleReader::parseContent() to decide whether character
- // data was read
- bool contentCharDataRead;
-
- // helper classes
- QScopedPointer<QXmlLocator> locator;
- QXmlNamespaceSupport namespaceSupport;
-
- // error string
- QString error;
-
- // arguments for parse functions (this is needed to allow incremental
- // parsing)
- bool parsePI_xmldecl;
- bool parseName_useRef;
- bool parseReference_charDataRead;
- EntityRecognitionContext parseReference_context;
- bool parseExternalID_allowPublicID;
- EntityRecognitionContext parsePEReference_context;
- QString parseString_s;
-
- // for incremental parsing
- struct ParseState {
- typedef bool (QXmlSimpleReaderPrivate::*ParseFunction)();
- ParseFunction function;
- int state;
- };
- QStack<ParseState> *parseStack;
-
- // used in parseProlog()
- bool xmldecl_possible;
- bool doctype_read;
-
- // used in parseDoctype()
- bool startDTDwasReported;
-
- // used in parseString()
- signed char Done;
-
-
- // variables
- QXmlContentHandler *contentHnd;
- QXmlErrorHandler *errorHnd;
- QXmlDTDHandler *dtdHnd;
- QXmlEntityResolver *entityRes;
- QXmlLexicalHandler *lexicalHnd;
- QXmlDeclHandler *declHnd;
-
- QXmlInputSource *inputSource;
-
- QChar c; // the character at reading position
- int lineNr; // number of line
- int columnNr; // position in line
-
- QChar nameArray[256]; // only used for names
- QString nameValue; // only used for names
- int nameArrayPos;
- int nameValueLen;
- QChar refArray[256]; // only used for references
- QString refValue; // only used for references
- int refArrayPos;
- int refValueLen;
- QChar stringArray[256]; // used for any other strings that are parsed
- QString stringValue; // used for any other strings that are parsed
- int stringArrayPos;
- int stringValueLen;
- QString emptyStr;
-
- QHash<QString, int> literalEntitySizes;
- // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times.
- QHash<QString, QHash<QString, int> > referencesToOtherEntities;
- QHash<QString, int> expandedSizes;
- // The limit to the amount of times the DTD parsing functions can be called
- // for the DTD currently being parsed.
- static const int dtdRecursionLimit = 2;
- // The maximum amount of characters an entity value may contain, after expansion.
- static const int entityCharacterLimit = 1024;
-
- const QString &string();
- void stringClear();
- void stringAddC(QChar);
- inline void stringAddC() { stringAddC(c); }
- const QString &name();
- void nameClear();
- void nameAddC(QChar);
- inline void nameAddC() { nameAddC(c); }
- const QString &ref();
- void refClear();
- void refAddC(QChar);
- inline void refAddC() { refAddC(c); }
-
- // private functions
- bool eat_ws();
- bool next_eat_ws();
-
- void QT_FASTCALL next();
- bool atEnd();
-
- void init(const QXmlInputSource* i);
- void initData();
-
- bool entityExist(const QString&) const;
-
- bool parseBeginOrContinue(int state, bool incremental);
-
- bool parseProlog();
- bool parseElement();
- bool processElementEmptyTag();
- bool processElementETagBegin2();
- bool processElementAttribute();
- bool parseMisc();
- bool parseContent();
-
- bool parsePI();
- bool parseDoctype();
- bool parseComment();
-
- bool parseName();
- bool parseNmtoken();
- bool parseAttribute();
- bool parseReference();
- bool processReference();
-
- bool parseExternalID();
- bool parsePEReference();
- bool parseMarkupdecl();
- bool parseAttlistDecl();
- bool parseAttType();
- bool parseAttValue();
- bool parseElementDecl();
- bool parseNotationDecl();
- bool parseChoiceSeq();
- bool parseEntityDecl();
- bool parseEntityValue();
-
- bool parseString();
-
- bool insertXmlRef(const QString&, const QString&, bool);
-
- bool reportEndEntities();
- void reportParseError(const QString& error);
-
- typedef bool (QXmlSimpleReaderPrivate::*ParseFunction) ();
- void unexpectedEof(ParseFunction where, int state);
- void parseFailed(ParseFunction where, int state);
- void pushParseState(ParseFunction function, int state);
-
- bool isExpandedEntityValueTooLarge(QString *errorMessage);
-
- Q_DECLARE_PUBLIC(QXmlSimpleReader)
- QXmlSimpleReader *q_ptr;
-
- friend class QXmlSimpleReaderLocator;
-};
-
/*!
\class QXmlParseException
\reentrant
@@ -3470,7 +3226,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
return false;
}
}
- qt_xml_skipped_entity_in_content = false;
+ d->skipped_entity_in_content = false;
return d->parseBeginOrContinue(0, incremental);
}
@@ -7834,13 +7590,13 @@ bool QXmlSimpleReaderPrivate::processReference()
}
if (contentHnd) {
- qt_xml_skipped_entity_in_content = parseReference_context == InContent;
+ skipped_entity_in_content = parseReference_context == InContent;
if (!contentHnd->skippedEntity(reference)) {
- qt_xml_skipped_entity_in_content = false;
+ skipped_entity_in_content = false;
reportParseError(contentHnd->errorString());
return false; // error
}
- qt_xml_skipped_entity_in_content = false;
+ skipped_entity_in_content = false;
}
}
} else if ((*itExtern).notation.isNull()) {
@@ -7870,13 +7626,13 @@ bool QXmlSimpleReaderPrivate::processReference()
}
}
if (skipIt && contentHnd) {
- qt_xml_skipped_entity_in_content = true;
+ skipped_entity_in_content = true;
if (!contentHnd->skippedEntity(reference)) {
- qt_xml_skipped_entity_in_content = false;
+ skipped_entity_in_content = false;
reportParseError(contentHnd->errorString());
return false; // error
}
- qt_xml_skipped_entity_in_content = false;
+ skipped_entity_in_content = false;
}
parseReference_charDataRead = false;
} break;
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 743f8702af..2f276f75c6 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -269,6 +269,7 @@ private:
QScopedPointer<QXmlSimpleReaderPrivate> d_ptr;
friend class QXmlSimpleReaderLocator;
+ friend class QDomHandler;
};
//
diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h
new file mode 100644
index 0000000000..1cb919a554
--- /dev/null
+++ b/src/xml/sax/qxml_p.h
@@ -0,0 +1,308 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtXml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QXML_P_H
+#define QXML_P_H
+
+#include <qstack.h>
+#include <qmap.h>
+#include <qxml.h>
+
+QT_BEGIN_NAMESPACE
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience of
+// qxml.cpp and qdom.cpp. This header file may change from version to version without
+// notice, or even be removed.
+//
+// We mean it.
+//
+
+class QXmlSimpleReaderPrivate
+{
+public:
+ ~QXmlSimpleReaderPrivate();
+private:
+ // functions
+ QXmlSimpleReaderPrivate(QXmlSimpleReader *reader);
+ void initIncrementalParsing();
+
+ // used to determine if elements are correctly nested
+ QStack<QString> tags;
+
+ // used by parseReference() and parsePEReference()
+ enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD };
+
+ // used for entity declarations
+ struct ExternParameterEntity
+ {
+ ExternParameterEntity() {}
+ ExternParameterEntity(const QString &p, const QString &s)
+ : publicId(p), systemId(s) {}
+ QString publicId;
+ QString systemId;
+
+ Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity)
+ };
+ struct ExternEntity
+ {
+ ExternEntity() {}
+ ExternEntity(const QString &p, const QString &s, const QString &n)
+ : publicId(p), systemId(s), notation(n) {}
+ QString publicId;
+ QString systemId;
+ QString notation;
+ Q_DUMMY_COMPARISON_OPERATOR(ExternEntity)
+ };
+ QMap<QString,ExternParameterEntity> externParameterEntities;
+ QMap<QString,QString> parameterEntities;
+ QMap<QString,ExternEntity> externEntities;
+ QMap<QString,QString> entities;
+
+ // used for parsing of entity references
+ struct XmlRef {
+ XmlRef()
+ : index(0) {}
+ XmlRef(const QString &_name, const QString &_value)
+ : name(_name), value(_value), index(0) {}
+ bool isEmpty() const { return index == value.length(); }
+ QChar next() { return value.at(index++); }
+ QString name;
+ QString value;
+ int index;
+ };
+ QStack<XmlRef> xmlRefStack;
+
+ // used for standalone declaration
+ enum Standalone { Yes, No, Unknown };
+
+ QString doctype; // only used for the doctype
+ QString xmlVersion; // only used to store the version information
+ QString encoding; // only used to store the encoding
+ Standalone standalone; // used to store the value of the standalone declaration
+
+ QString publicId; // used by parseExternalID() to store the public ID
+ QString systemId; // used by parseExternalID() to store the system ID
+
+ // Since publicId/systemId is used as temporary variables by parseExternalID(), it
+ // might overwrite the PUBLIC/SYSTEM for the document we're parsing. In effect, we would
+ // possibly send off an QXmlParseException that has the PUBLIC/SYSTEM of a entity declaration
+ // instead of those of the current document.
+ // Hence we have these two variables for storing the document's data.
+ QString thisPublicId;
+ QString thisSystemId;
+
+ QString attDeclEName; // use by parseAttlistDecl()
+ QString attDeclAName; // use by parseAttlistDecl()
+
+ // flags for some features support
+ bool useNamespaces;
+ bool useNamespacePrefixes;
+ bool reportWhitespaceCharData;
+ bool reportEntities;
+
+ // used to build the attribute list
+ QXmlAttributes attList;
+
+ // used in QXmlSimpleReader::parseContent() to decide whether character
+ // data was read
+ bool contentCharDataRead;
+ // Hack for letting QDom know where the skipped entity occurred
+ bool skipped_entity_in_content;
+
+ // helper classes
+ QScopedPointer<QXmlLocator> locator;
+ QXmlNamespaceSupport namespaceSupport;
+
+ // error string
+ QString error;
+
+ // arguments for parse functions (this is needed to allow incremental
+ // parsing)
+ bool parsePI_xmldecl;
+ bool parseName_useRef;
+ bool parseReference_charDataRead;
+ EntityRecognitionContext parseReference_context;
+ bool parseExternalID_allowPublicID;
+ EntityRecognitionContext parsePEReference_context;
+ QString parseString_s;
+
+ // for incremental parsing
+ struct ParseState {
+ typedef bool (QXmlSimpleReaderPrivate::*ParseFunction)();
+ ParseFunction function;
+ int state;
+ };
+ QStack<ParseState> *parseStack;
+
+ // used in parseProlog()
+ bool xmldecl_possible;
+ bool doctype_read;
+
+ // used in parseDoctype()
+ bool startDTDwasReported;
+
+ // used in parseString()
+ signed char Done;
+
+
+ // variables
+ QXmlContentHandler *contentHnd;
+ QXmlErrorHandler *errorHnd;
+ QXmlDTDHandler *dtdHnd;
+ QXmlEntityResolver *entityRes;
+ QXmlLexicalHandler *lexicalHnd;
+ QXmlDeclHandler *declHnd;
+
+ QXmlInputSource *inputSource;
+
+ QChar c; // the character at reading position
+ int lineNr; // number of line
+ int columnNr; // position in line
+
+ QChar nameArray[256]; // only used for names
+ QString nameValue; // only used for names
+ int nameArrayPos;
+ int nameValueLen;
+ QChar refArray[256]; // only used for references
+ QString refValue; // only used for references
+ int refArrayPos;
+ int refValueLen;
+ QChar stringArray[256]; // used for any other strings that are parsed
+ QString stringValue; // used for any other strings that are parsed
+ int stringArrayPos;
+ int stringValueLen;
+ QString emptyStr;
+
+ QHash<QString, int> literalEntitySizes;
+ // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times.
+ QHash<QString, QHash<QString, int> > referencesToOtherEntities;
+ QHash<QString, int> expandedSizes;
+ // The limit to the amount of times the DTD parsing functions can be called
+ // for the DTD currently being parsed.
+ static const int dtdRecursionLimit = 2;
+ // The maximum amount of characters an entity value may contain, after expansion.
+ static const int entityCharacterLimit = 1024;
+
+ const QString &string();
+ void stringClear();
+ void stringAddC(QChar);
+ inline void stringAddC() { stringAddC(c); }
+ const QString &name();
+ void nameClear();
+ void nameAddC(QChar);
+ inline void nameAddC() { nameAddC(c); }
+ const QString &ref();
+ void refClear();
+ void refAddC(QChar);
+ inline void refAddC() { refAddC(c); }
+
+ // private functions
+ bool eat_ws();
+ bool next_eat_ws();
+
+ void QT_FASTCALL next();
+ bool atEnd();
+
+ void init(const QXmlInputSource* i);
+ void initData();
+
+ bool entityExist(const QString&) const;
+
+ bool parseBeginOrContinue(int state, bool incremental);
+
+ bool parseProlog();
+ bool parseElement();
+ bool processElementEmptyTag();
+ bool processElementETagBegin2();
+ bool processElementAttribute();
+ bool parseMisc();
+ bool parseContent();
+
+ bool parsePI();
+ bool parseDoctype();
+ bool parseComment();
+
+ bool parseName();
+ bool parseNmtoken();
+ bool parseAttribute();
+ bool parseReference();
+ bool processReference();
+
+ bool parseExternalID();
+ bool parsePEReference();
+ bool parseMarkupdecl();
+ bool parseAttlistDecl();
+ bool parseAttType();
+ bool parseAttValue();
+ bool parseElementDecl();
+ bool parseNotationDecl();
+ bool parseChoiceSeq();
+ bool parseEntityDecl();
+ bool parseEntityValue();
+
+ bool parseString();
+
+ bool insertXmlRef(const QString&, const QString&, bool);
+
+ bool reportEndEntities();
+ void reportParseError(const QString& error);
+
+ typedef bool (QXmlSimpleReaderPrivate::*ParseFunction) ();
+ void unexpectedEof(ParseFunction where, int state);
+ void parseFailed(ParseFunction where, int state);
+ void pushParseState(ParseFunction function, int state);
+
+ bool isExpandedEntityValueTooLarge(QString *errorMessage);
+
+ Q_DECLARE_PUBLIC(QXmlSimpleReader)
+ QXmlSimpleReader *q_ptr;
+
+ friend class QXmlSimpleReaderLocator;
+ friend class QDomHandler;
+};
+
+QT_END_NAMESPACE
+
+#endif // QXML_P_H