Home

QtLibxmlReader overview

QtLibxmlReader is a SAX2 parser. Like QXmlSimpleReader, it inherits QXmlReader and therefore Qt's SAX API. Unlike QXmlSimpleReader, QtLibxmlReader uses libxml2 to do the actual parsing.

For the most part, QtLibxmlReader behaves just like QXmlSimpleReader. In particular, you can reuse your QXml*Handler objects.

The following differences were noted during testing:

QXmlSimpleReaderQtLibxmlReader
Calls QContentHandler::skippedEntity() for every reference to an external entity, unless a QXmlEntityResolver is created to load it.If the NOENT feature is set, loads external entities from the local filesystem, or from the network via HTTP or FTP. If the NOENT feature is not set, reports external entity references with QContentHandler::skippedEntity(). In either case internal entity references are replaced. Does not support QXmlEntityResolver.
The type and valueDefault arguments passed to QXmlDeclHandler::attributeDecl() are always empty.The type and valueDefault arguments passed to QXmlDeclHandler::attributeDecl() are set correctly.
Merges a sequence of entity references into a single call to QXmlContentHandler::characters(), which is passed the replacement text of the whole sequence.Issues a separate call to XmlContentHandler::characters() for each entity reference, passing in the replacement text for that single entity.
Calls QXmlContentHandler::processingInstruction() for all processing instructions.Calls QXmlContentHandler::processingInstruction() for all processing instructions except <?xml ... ?>.
Substitues entity references with their replacement text in attribute values.Does not substitute entity references in attribute values.
Sequences of whitespace characters in attribute values are reported unchanged.Sequences of whitespace characters in attribute values are replaced with a single space.
When calling QXmlContentHandler::characters(), "\r" and "\r\n" are reported unchanged.When calling QXmlContentHandler::characters(), "\r" and "\r\n" are replaced with "\n".
Only reports attributes that are present in an element.If an element has a default attribute defined in the DTD, this attribute is always reported.
setFeature() manipulates QXmlSimpleReader's features.setFeature() manipulates a subset of libxml2's features.
Supports incremental parsing.Does not support incremental parsing.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions