|  | Home · Overviews · Examples |

# QXmlReader Class Reference
[com.trolltech.qt.xml module]

The `QXmlReader` class provides an interface for XML readers (i.e. parsers). More...

Inherited by `QXmlSimpleReader`.

## Detailed Description

The `QXmlReader` class provides an interface for XML readers (i.e. parsers).

This abstract class provides an interface for all of Qt's XML readers. Currently there is only one implementation of a reader included in Qt's XML module: `QXmlSimpleReader`. In future releases there might be more readers with different properties available (e.g. a validating parser).

The design of the XML classes follows the SAX2 Java interface, with the names adapted to fit Qt naming conventions. It should be very easy for anybody who has worked with SAX2 to get started with the Qt XML classes.

All readers use the class `QXmlInputSource` to read the input document. Since you are normally interested in particular content in the XML document, the reader reports the content through special handler classes (`QXmlDTDHandler`, `QXmlDeclHandler`, `QXmlContentHandler`, `QXmlEntityResolver`, `QXmlErrorHandler` and `QXmlLexicalHandler`), which you must subclass, if you want to process the contents.

Since the handler classes only describe interfaces you must implement all the functions. We provide the `QXmlDefaultHandler` class to make this easier: it implements a default behavior (do nothing) for all functions, so you can subclass it and just implement the functions you are interested in.

Features and properties of the reader can be set with `setFeature` and setProperty() respectively. You can set the reader to use your own subclasses with `setEntityResolver`, `setDTDHandler`, `setContentHandler`, `setErrorHandler`, `setLexicalHandler` and `setDeclHandler`. The parse itself is started with a call to `parse`.

See also `QXmlSimpleReader`.