diff options
Diffstat (limited to 'src/xml/dom/qdomhelpers_p.h')
-rw-r--r-- | src/xml/dom/qdomhelpers_p.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/xml/dom/qdomhelpers_p.h b/src/xml/dom/qdomhelpers_p.h index 7647de65d2..f5efd8a42d 100644 --- a/src/xml/dom/qdomhelpers_p.h +++ b/src/xml/dom/qdomhelpers_p.h @@ -39,6 +39,7 @@ #ifndef QDOMHELPERS_P_H #define QDOMHELPERS_P_H +#include <qcoreapplication.h> #include <qglobal.h> #include <qxml.h> @@ -57,6 +58,8 @@ QT_BEGIN_NAMESPACE class QDomDocumentPrivate; class QDomNodePrivate; +class QXmlStreamReader; +class QXmlStreamAttributes; /************************************************************** * @@ -77,6 +80,19 @@ public: virtual int line() const = 0; }; +class QDomDocumentLocator : public QXmlDocumentLocator +{ +public: + QDomDocumentLocator(QXmlStreamReader *r) : reader(r) {} + ~QDomDocumentLocator() override = default; + + int column() const override; + int line() const override; + +private: + QXmlStreamReader *reader; +}; + class QSAXDocumentLocator : public QXmlDocumentLocator { public: @@ -105,6 +121,7 @@ public: bool endDocument(); bool startElement(const QString &nsURI, const QString &qName, const QXmlAttributes &atts); + bool startElement(const QString &nsURI, const QString &qName, const QXmlStreamAttributes &atts); bool endElement(); bool characters(const QString &characters, bool cdata = false); bool processingInstruction(const QString &target, const QString &data); @@ -188,6 +205,31 @@ private: QDomBuilder domBuilder; }; +/************************************************************** + * + * QDomParser + * + **************************************************************/ + +class QDomParser +{ + Q_DECLARE_TR_FUNCTIONS(QDomParser) +public: + QDomParser(QDomDocumentPrivate *d, QXmlStreamReader *r, bool namespaceProcessing); + + bool parse(); + QDomBuilder::ErrorInfo errorInfo() const; + +private: + bool parseProlog(); + bool parseBody(); + bool parseMarkupDecl(); + + QXmlStreamReader *reader; + QDomDocumentLocator locator; + QDomBuilder domBuilder; +}; + QT_END_NAMESPACE #endif // QDOMHELPERS_P_H |