QXmlContentHandler Class

The QXmlContentHandler class provides an interface to report the logical content of XML data. More...

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

QXmlDefaultHandler

Note: All functions in this class are reentrant.

Public Functions

virtual ~QXmlContentHandler()
virtual bool characters(const QString &ch) = 0
virtual bool endDocument() = 0
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) = 0
virtual bool endPrefixMapping(const QString &prefix) = 0
virtual QString errorString() const = 0
virtual bool ignorableWhitespace(const QString &ch) = 0
virtual bool processingInstruction(const QString &target, const QString &data) = 0
virtual void setDocumentLocator(QXmlLocator *locator) = 0
virtual bool skippedEntity(const QString &name) = 0
virtual bool startDocument() = 0
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) = 0
virtual bool startPrefixMapping(const QString &prefix, const QString &uri) = 0

Detailed Description

The QXmlContentHandler class provides an interface to report the logical content of XML data.

If the application needs to be informed of basic parsing events, it can implement this interface and activate it using QXmlReader::setContentHandler(). The reader can then report basic document-related events like the start and end of elements and character data through this interface.

The order of events in this interface is very important, and mirrors the order of information in the document itself. For example, all of an element's content (character data, processing instructions, and sub-elements) appears, in order, between the startElement() event and the corresponding endElement() event.

The class QXmlDefaultHandler provides a default implementation for this interface; subclassing from the QXmlDefaultHandler class is very convenient if you only want to be informed of some parsing events.

The startDocument() function is called at the start of the document, and endDocument() is called at the end. Before parsing begins setDocumentLocator() is called. For each element startElement() is called, with endElement() being called at the end of each element. The characters() function is called with chunks of character data; ignorableWhitespace() is called with chunks of whitespace and processingInstruction() is called with processing instructions. If an entity is skipped skippedEntity() is called. At the beginning of prefix-URI scopes startPrefixMapping() is called.

See also QXmlDTDHandler, QXmlDeclHandler, QXmlEntityResolver, QXmlErrorHandler, QXmlLexicalHandler, and Introduction to SAX2.

Member Function Documentation

[virtual] QXmlContentHandler::~QXmlContentHandler()

Destroys the instance of QXmlContentHandler. The destructor is virtual.

[pure virtual] bool QXmlContentHandler::characters(const QString &ch)

[pure virtual] bool QXmlContentHandler::endDocument()

[pure virtual] bool QXmlContentHandler::endElement(const QString &namespaceURI, const QString &localName, const QString &qName)

[pure virtual] bool QXmlContentHandler::endPrefixMapping(const QString &prefix)

[pure virtual] QString QXmlContentHandler::errorString() const

[pure virtual] bool QXmlContentHandler::ignorableWhitespace(const QString &ch)

[pure virtual] bool QXmlContentHandler::processingInstruction(const QString &target, const QString &data)

[pure virtual] void QXmlContentHandler::setDocumentLocator(QXmlLocator *locator)

[pure virtual] bool QXmlContentHandler::skippedEntity(const QString &name)

[pure virtual] bool QXmlContentHandler::startDocument()

[pure virtual] bool QXmlContentHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)

[pure virtual] bool QXmlContentHandler::startPrefixMapping(const QString &prefix, const QString &uri)