The QXmlContentHandler class provides an interface to report the logical content of XML data.
.PP
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.
.PP
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.
.PP
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.
.PP
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.
.PP
See also the Introduction to SAX2.
.PP
See also QXmlDTDHandler, QXmlDeclHandler, QXmlEntityResolver, QXmlErrorHandler, QXmlLexicalHandler, and XML.
The reader calls this function when it has parsed a chunk of character data (either normal character data or character data inside a CDATA section; if you need to distinguish between those two types you must use QXmlLexicalHandler::startCDATA() and QXmlLexicalHandler::endCDATA()). The character data is reported in \fIch\fR.
.PP
Some readers report whitespace in element content using the ignorableWhitespace() function rather than using this one.
.PP
A reader may report the character data of an element in more than one chunk; e.g. a reader might want to report "a<b" in three characters() events ("a ", "<" and " b").
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
The reader calls this function after it has finished parsing. It is called just once, and is the last handler function called. It is called after the reader has read all input or has abandoned parsing because of a fatal error.
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
The reader calls this function when it has parsed an end element tag with the qualified name \fIqName\fR, the local name \fIlocalName\fR and the namespace URI \fInamespaceURI\fR.
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
The reader calls this function before it starts parsing the document. The argument \fIlocator\fR is a pointer to a QXmlLocator which allows the application to get the parsing position within the document.
.PP
Do not destroy the \fIlocator\fR; it is destroyed when the reader is destroyed. (Do not use the \fIlocator\fR after the reader is destroyed).
Some readers may skip entities if they have not seen the declarations (e.g. because they are in an external DTD). If they do so they report that they skipped the entity called \fIname\fR by calling this function.
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
The reader calls this function when it starts parsing the document. The reader calls this function just once, after the call to setDocumentLocator(), and before any other functions in this class or in the QXmlDTDHandler class are called.
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
The reader calls this function when it has parsed a start element tag.
.PP
There is a corresponding endElement() call when the corresponding end element tag is read. The startElement() and endElement() calls are always nested correctly. Empty element tags (e.g. \fC<x/>\fR) cause a startElement() call to be immediately followed by an endElement() call.
.PP
The attribute list provided only contains attributes with explicit values. The attribute list contains attributes used for namespace declaration (i.e. attributes starting with xmlns) only if the namespace-prefix property of the reader is TRUE.
.PP
The argument \fInamespaceURI\fR is the namespace URI, or QString::null if the element has no namespace URI or if no namespace processing is done. \fIlocalName\fR is the local name (without prefix), or QString::null if no namespace processing is done, \fIqName\fR is the qualified name (with prefix) and \fIatts\fR are the attributes attached to the element. If there are no attributes, \fIatts\fR is an empty attributes object.
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
The reader calls this function to signal the begin of a prefix-URI namespace mapping scope. This information is not necessary for normal namespace processing since the reader automatically replaces prefixes for element and attribute names.
.PP
Note that startPrefixMapping() and endPrefixMapping() calls are not guaranteed to be properly nested relative to each other: all startPrefixMapping() events occur before the corresponding startElement() event, and all endPrefixMapping() events occur after the corresponding endElement() event, but their order is not otherwise guaranteed.
.PP
The argument \fIprefix\fR is the namespace prefix being declared and the argument \fIuri\fR is the namespace URI the prefix is mapped to.
.PP
If this function returns FALSE the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.