Home

QtLibxmlReader Class Reference

The QtLibxmlReader class is a SAX2 parser based on libxml2, with a QXmlReader interface. More...

 #include <QtLibxmlReader>

Inherits QXmlReader.

Public Functions


Detailed Description

The QtLibxmlReader class is a SAX2 parser based on libxml2, with a QXmlReader interface.

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 an overview of differences between QtLibxmlReader and QXmlSimpleReader, see the overview.

For more information on Qt's SAX2 interface, see the documentation for QXmlReader and QtXmlSimpleReader.


Member Function Documentation

QtLibxmlReader::QtLibxmlReader ()

Constructs a QtLibxmlReader object.

QtLibxmlReader::~QtLibxmlReader ()   [virtual]

Destroys a QtLibxmlReader object.

QXmlDTDHandler * QtLibxmlReader::DTDHandler () const   [virtual]

Returns the DTD handler or 0 if none was set.

Reimplemented from QXmlReader.

See also setDTDHandler().

QXmlContentHandler * QtLibxmlReader::contentHandler () const   [virtual]

Returns the content handler or 0 if none was set.

Reimplemented from QXmlReader.

See also setContentHandler().

QXmlDeclHandler * QtLibxmlReader::declHandler () const   [virtual]

Returns the declaration handler or 0 if none was set.

Reimplemented from QXmlReader.

See also setDeclHandler().

QXmlEntityResolver * QtLibxmlReader::entityResolver () const   [virtual]

Returns 0. QXmlEntityResolver is not supported.

Instead, if the NOENT feature is set, libxml2 loads external entities from the local filesystem, or from the network via HTTP or FTP. If the NOENT feature is not set, reports all entity references with QContentHandler::skippedEntity().

Reimplemented from QXmlReader.

See also setEntityResolver(), property(), and setProperty().

QXmlErrorHandler * QtLibxmlReader::errorHandler () const   [virtual]

Returns the error handler or 0 if none is set.

Reimplemented from QXmlReader.

See also setErrorHandler().

bool QtLibxmlReader::feature ( const QString & name, bool * ok = 0 ) const   [virtual]

If the reader has the feature called name, the feature's value is returned. If no such feature exists the return value is undefined.

If ok is not 0: ok is set to TRUE if the reader has the feature called name; otherwise ok is set to FALSE.

Reimplemented from QXmlReader.

See also setFeature() and hasFeature().

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

Returns TRUE if the reader has the feature called name; otherwise returns FALSE.

Reimplemented from QXmlReader.

See also feature() and setFeature().

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

Returns TRUE if the reader has the property name; otherwise returns FALSE.

Reimplemented from QXmlReader.

See also property() and setProperty().

QXmlLexicalHandler * QtLibxmlReader::lexicalHandler () const   [virtual]

Returns the lexical handler or 0 if none was set.

Reimplemented from QXmlReader.

See also setLexicalHandler().

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

Reads an XML document from input in and parses it. Returns FALSE if the parsing detects an error; otherwise returns TRUE.

Reimplemented from QXmlReader.

bool QtLibxmlReader::parse ( const QString & uri )

Reads an XML document from uri and parses it. uri may be a file name, or a HTTP or FTP url. Returns FALSE if the parsing detects an error; otherwise returns TRUE.

This function does not use QXmlInputSource. Instead, uri is passed directly to libxml2. This has several advantages:

void * QtLibxmlReader::property ( const QString & name, bool * ok = 0 ) const   [virtual]

If the reader has the property name, this function returns the value of the property; otherwise the return value is undefined.

If ok is not 0 and the reader has the name property, ok is set to TRUE; otherwise ok is set to FALSE.

Reimplemented from QXmlReader.

See also setProperty() and hasProperty().

void QtLibxmlReader::setContentHandler ( QXmlContentHandler * handler )   [virtual]

Sets the content handler to handler.

Reimplemented from QXmlReader.

See also contentHandler().

void QtLibxmlReader::setDTDHandler ( QXmlDTDHandler * handler )   [virtual]

Sets the DTD handler to handler.

Reimplemented from QXmlReader.

See also DTDHandler().

void QtLibxmlReader::setDeclHandler ( QXmlDeclHandler * handler )   [virtual]

Sets the declaration handler to handler.

Reimplemented from QXmlReader.

See also declHandler().

void QtLibxmlReader::setEntityResolver ( QXmlEntityResolver * resolver )   [virtual]

Does nothing. QXmlEntityResolver is not supported. resolver is ignored.

Instead, if the NOENT feature is set, libxml2 loads external entities from the local filesystem, or from the network via HTTP or FTP. If the NOENT feature is not set, reports all entity references with QContentHandler::skippedEntity().

Reimplemented from QXmlReader.

See also entityResolver(), property(), and setProperty().

void QtLibxmlReader::setErrorHandler ( QXmlErrorHandler * handler )   [virtual]

Sets the error handler to handler. Clears the error handler if handler is 0.

Reimplemented from QXmlReader.

See also errorHandler().

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

Sets the state of the feature name to value:

If the feature is not recognized, it is ignored.

The following features are supported:

FeatureNotes
http://qtsoftware.com/xml/features/LIBXML2_NOENTIf this feature is TRUE, QXmlContentHandler::skippedEntity() is not called for external entity references. Instead, the parser replaces them with their replacement text. QtLibxmlReader can load external entities from the local filesystem, or from the network via HTTP or FTP. If this feature is FALSE (the default), all external entity references are reported with QXmlContentHandler::skippedEntity(). In either case, internal entities are replaced and undefined entities are reported with QXmlErrorHandler::error().
http://qtsoftware.com/xml/features/LIBXML2_RECOVERIf this feature is TRUE, the parser continues parsing after QXmlErrorHandler::error(). If this feature is FALSE (the default), the parser stops after QXmlErrorHandler::error().

Reimplemented from QXmlReader.

See also feature() and hasFeature().

void QtLibxmlReader::setLexicalHandler ( QXmlLexicalHandler * handler )   [virtual]

Sets the lexical handler to handler.

Reimplemented from QXmlReader.

See also lexicalHandler().

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

Sets the property name to value. If the reader doesn't have the property nothing happens.

Reimplemented from QXmlReader.

See also property() and hasProperty().


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