Home

QtLibxmlReader Class Reference

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

All the functions in this class are reentrant when Qt is built with thread support.

#include <qtlibxmlreader.h>

List of all member functions.

Public Members


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

Returns the DTD handler or 0 if none was set.

See also setDTDHandler().

QXmlContentHandler * QtLibxmlReader::contentHandler () const

Returns the content handler or 0 if none was set.

See also setContentHandler().

QXmlDeclHandler * QtLibxmlReader::declHandler () const

Returns the declaration handler or 0 if none was set.

See also setDeclHandler().

QXmlEntityResolver * QtLibxmlReader::entityResolver () const

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().

See also property() and setProperty().

QXmlErrorHandler * QtLibxmlReader::errorHandler () const

Returns the error handler or 0 if none is set.

See also setErrorHandler().

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

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.

See also setFeature() and hasFeature().

bool QtLibxmlReader::hasFeature ( const QString & name ) const

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

See also feature() and setFeature().

bool QtLibxmlReader::hasProperty ( const QString & name ) const

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

See also property() and setProperty().

QXmlLexicalHandler * QtLibxmlReader::lexicalHandler () const

Returns the lexical handler or 0 if none was set.

See also setLexicalHandler().

bool QtLibxmlReader::parse ( const QXmlInputSource * in, bool incremental )

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

Incremental parsing is not supported. If incremental is TRUE, prints a warning message and returns FALSE.

bool QtLibxmlReader::parse ( const QXmlInputSource & input )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

bool QtLibxmlReader::parse ( const QXmlInputSource * input )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

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:

bool QtLibxmlReader::parseContinue () [virtual]

Prints a warning message and returns FALSE. Incremental parsing is not supported.

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

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: if the reader has the name property *ok is set to TRUE; otherwise *ok is set to FALSE.

See also setProperty() and hasProperty().

void QtLibxmlReader::setContentHandler ( QXmlContentHandler * handler )

Sets the content handler to handler.

See also contentHandler().

void QtLibxmlReader::setDTDHandler ( QXmlDTDHandler * handler )

Sets the DTD handler to handler.

See also DTDHandler().

void QtLibxmlReader::setDeclHandler ( QXmlDeclHandler * handler )

Sets the declaration handler to handler.

See also declHandler().

void QtLibxmlReader::setEntityResolver ( QXmlEntityResolver * )

Does nothing. 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().

See also property() and setProperty().

void QtLibxmlReader::setErrorHandler ( QXmlErrorHandler * handler )

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

See also errorHandler().

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

Sets the state of the feature name to value:

If the feature is not recognized, it is ignored.

The following features are supported:

Feature Notes
http://trolltech.com/xml/features/LIBXML2_NOENT If 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://trolltech.com/xml/features/LIBXML2_RECOVER If this feature is TRUE, the parser continues parsing after QXmlErrorHandler::error(). If this feature is FALSE (the default), the parser stops after QXmlErrorHandler::error().

See also feature() and hasFeature().

void QtLibxmlReader::setLexicalHandler ( QXmlLexicalHandler * handler )

Sets the lexical handler to handler.

See also lexicalHandler().

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

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

See also property() and hasProperty().


This file is part of the Qt Solutions. Copyright © 2003-2004 Trolltech. All Rights Reserved.

Copyright © 2003-2004 TrolltechTrademarks
Qt Solutions