CopperSpice API
1.9.2
|
The QXmlReader class provides an interface for XML readers. More...
Public Methods | |
virtual | ~QXmlReader () |
virtual QXmlContentHandler * | contentHandler () const = 0 |
virtual QXmlDeclHandler * | declHandler () const = 0 |
virtual QXmlDTDHandler * | DTDHandler () const = 0 |
virtual QXmlEntityResolver * | entityResolver () const = 0 |
virtual QXmlErrorHandler * | errorHandler () const = 0 |
virtual bool | feature (const QString &name, bool *ok=nullptr) const = 0 |
virtual bool | hasFeature (const QString &name) const = 0 |
virtual bool | hasProperty (const QString &name) const = 0 |
virtual QXmlLexicalHandler * | lexicalHandler () const = 0 |
virtual bool | parse (const QXmlInputSource &input) = 0 |
virtual bool | parse (const QXmlInputSource *input) = 0 |
virtual void * | property (const QString &name, bool *ok=nullptr) const = 0 |
virtual void | setContentHandler (QXmlContentHandler *handler) = 0 |
virtual void | setDeclHandler (QXmlDeclHandler *handler) = 0 |
virtual void | setDTDHandler (QXmlDTDHandler *handler) = 0 |
virtual void | setEntityResolver (QXmlEntityResolver *handler) = 0 |
virtual void | setErrorHandler (QXmlErrorHandler *handler) = 0 |
virtual void | setFeature (const QString &name, bool value) = 0 |
virtual void | setLexicalHandler (QXmlLexicalHandler *handler) = 0 |
virtual void | setProperty (const QString &name, void *value) = 0 |
The QXmlReader class provides an interface for XML readers.
This abstract class provides an interface for all of the CopperSpice XML readers. Currently there is only one implementation of a reader included in the CopperSpice XML library, 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 CopperSpice naming conventions. It should be very easy for anybody who has worked with SAX2 to get started with the CopperSpice 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().
|
inlinevirtual |
Destroys the reader.
|
pure virtual |
Returns the content handler or a nullptr if none was set.
Implemented in QXmlSimpleReader::contentHandler()
|
pure virtual |
Returns the declaration handler or a nullptr if none was set.
Implemented in QXmlSimpleReader::declHandler()
|
pure virtual |
Returns the DTD handler or a nullptr if none was set.
Implemented in QXmlSimpleReader::DTDHandler()
|
pure virtual |
Returns the entity resolver or a nullptr if none was set.
Implemented in QXmlSimpleReader::entityResolver()
|
pure virtual |
Returns the error handler or a nullptr if none is set.
Implemented in QXmlSimpleReader::errorHandler()
|
pure 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.
Implemented in QXmlSimpleReader::feature()
|
pure virtual |
Returns true
if the reader has the feature called name, otherwise returns false.
Implemented in QXmlSimpleReader::hasFeature()
|
pure virtual |
Returns true if the reader has the property name, otherwise returns false.
Implemented in QXmlSimpleReader::hasProperty()
|
pure virtual |
Returns the lexical handler or a nullptr if none was set.
Implemented in QXmlSimpleReader::lexicalHandler()
|
deprecatedpure virtual |
Implemented in QXmlSimpleReader::parse()
|
pure virtual |
Reads an XML document from input and parses it. Returns true if the parsing was successful, otherwise returns false.
Implemented in QXmlSimpleReader::parse()
|
pure 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: if the reader has the name property *
ok is set to true, otherwise *
ok is set to false.
Implemented in QXmlSimpleReader::property()
|
pure virtual |
Sets the content handler to handler.
Implemented in QXmlSimpleReader::setContentHandler()
|
pure virtual |
Sets the declaration handler to handler.
Implemented in QXmlSimpleReader::setDeclHandler()
|
pure virtual |
Sets the DTD handler to handler.
Implemented in QXmlSimpleReader::setDTDHandler()
|
pure virtual |
Sets the entity resolver to handler.
Implemented in QXmlSimpleReader::setEntityResolver()
|
pure virtual |
Sets the error handler to handler. Clears the error handler if handler is 0.
Implemented in QXmlSimpleReader::setErrorHandler()
|
pure virtual |
Sets the feature called name to the given value. If the reader does not have the feature nothing happens.
Implemented in QXmlSimpleReader::setFeature()
|
pure virtual |
Sets the lexical handler to handler.
Implemented in QXmlSimpleReader::setLexicalHandler()
|
pure virtual |
Sets the property name to value. If the reader does not have the property nothing happens.
Implemented in QXmlSimpleReader::setProperty()