QXmlReader Class

The QXmlReader class provides an interface for XML readers (i.e. parsers). More...

Header: #include <QXmlReader>
qmake: QT += xml
Inherited By:

QXmlSimpleReader

Note: All functions in this class are reentrant.

Public Functions

virtual ~QXmlReader()
virtual QXmlDTDHandler *DTDHandler() const = 0
virtual QXmlContentHandler *contentHandler() const = 0
virtual QXmlDeclHandler *declHandler() const = 0
virtual QXmlEntityResolver *entityResolver() const = 0
virtual QXmlErrorHandler *errorHandler() const = 0
virtual bool feature(const QString &name, bool *ok = nullptr) const = 0
virtual bool hasFeature(const QString &name) const = 0
virtual bool hasProperty(const QString &name) const = 0
virtual QXmlLexicalHandler *lexicalHandler() const = 0
virtual bool parse(const QXmlInputSource &input) = 0
virtual bool parse(const QXmlInputSource *input) = 0
virtual void *property(const QString &name, bool *ok = nullptr) const = 0
virtual void setContentHandler(QXmlContentHandler *handler) = 0
virtual void setDTDHandler(QXmlDTDHandler *handler) = 0
virtual void setDeclHandler(QXmlDeclHandler *handler) = 0
virtual void setEntityResolver(QXmlEntityResolver *handler) = 0
virtual void setErrorHandler(QXmlErrorHandler *handler) = 0
virtual void setFeature(const QString &name, bool value) = 0
virtual void setLexicalHandler(QXmlLexicalHandler *handler) = 0
virtual void setProperty(const QString &name, void *value) = 0

Detailed Description

The QXmlReader class provides an interface for XML readers (i.e. parsers).

This abstract class provides an interface for all of Qt's XML readers. Currently there is only one implementation of a reader included in Qt's XML module: QXmlSimpleReader. In future releases there might be more readers with different properties available (e.g. a validating parser).

The design of the XML classes follows the SAX2 Java interface, with the names adapted to fit Qt naming conventions. It should be very easy for anybody who has worked with SAX2 to get started with the Qt XML classes.

All readers use the class QXmlInputSource to read the input document. Since you are normally interested in particular content in the XML document, the reader reports the content through special handler classes (QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler and QXmlLexicalHandler), which you must subclass, if you want to process the contents.

Since the handler classes only describe interfaces you must implement all the functions. We provide the QXmlDefaultHandler class to make this easier: it implements a default behavior (do nothing) for all functions, so you can subclass it and just implement the functions you are interested in.

Features and properties of the reader can be set with setFeature() and setProperty() respectively. You can set the reader to use your own subclasses with setEntityResolver(), setDTDHandler(), setContentHandler(), setErrorHandler(), setLexicalHandler() and setDeclHandler(). The parse itself is started with a call to parse().

See also QXmlSimpleReader.

Member Function Documentation

[virtual] QXmlReader::~QXmlReader()

Destroys the instance of QXmlReader. The destructor is virtual.

[pure virtual] QXmlDTDHandler *QXmlReader::DTDHandler() const

See also setDTDHandler().

[pure virtual] QXmlContentHandler *QXmlReader::contentHandler() const

See also setContentHandler().

[pure virtual] QXmlDeclHandler *QXmlReader::declHandler() const

See also setDeclHandler().

[pure virtual] QXmlEntityResolver *QXmlReader::entityResolver() const

See also setEntityResolver().

[pure virtual] QXmlErrorHandler *QXmlReader::errorHandler() const

See also setErrorHandler().

[pure virtual] bool QXmlReader::feature(const QString &name, bool *ok = nullptr) const

See also setFeature().

[pure virtual] bool QXmlReader::hasFeature(const QString &name) const

[pure virtual] bool QXmlReader::hasProperty(const QString &name) const

[pure virtual] QXmlLexicalHandler *QXmlReader::lexicalHandler() const

See also setLexicalHandler().

[pure virtual] bool QXmlReader::parse(const QXmlInputSource &input)

[pure virtual] bool QXmlReader::parse(const QXmlInputSource *input)

[pure virtual] void *QXmlReader::property(const QString &name, bool *ok = nullptr) const

See also setProperty().

[pure virtual] void QXmlReader::setContentHandler(QXmlContentHandler *handler)

See also contentHandler().

[pure virtual] void QXmlReader::setDTDHandler(QXmlDTDHandler *handler)

[pure virtual] void QXmlReader::setDeclHandler(QXmlDeclHandler *handler)

See also declHandler().

[pure virtual] void QXmlReader::setEntityResolver(QXmlEntityResolver *handler)

See also entityResolver().

[pure virtual] void QXmlReader::setErrorHandler(QXmlErrorHandler *handler)

See also errorHandler().

[pure virtual] void QXmlReader::setFeature(const QString &name, bool value)

See also feature().

[pure virtual] void QXmlReader::setLexicalHandler(QXmlLexicalHandler *handler)

See also lexicalHandler().

[pure virtual] void QXmlReader::setProperty(const QString &name, void *value)

See also property().