|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.xml.QXmlReader
public abstract class QXmlReader
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Constructor Summary | |
---|---|
QXmlReader()
Creates a new QXmlReader. |
Method Summary | |
---|---|
abstract QXmlContentHandlerInterface |
contentHandler()
Returns the content handler or 0 if none was set. |
abstract QXmlDeclHandlerInterface |
declHandler()
Returns the declaration handler or 0 if none was set. |
abstract QXmlDTDHandlerInterface |
DTDHandler()
Returns the DTD handler or 0 if none was set. |
abstract QXmlEntityResolverInterface |
entityResolver()
Returns the entity resolver or 0 if none was set. |
abstract QXmlErrorHandlerInterface |
errorHandler()
Returns the error handler or 0 if none is set. |
abstract boolean |
feature(java.lang.String name)
Equivalent to feature(name, 0). |
static QXmlReader |
fromNativePointer(QNativePointer nativePointer)
This function returns the QXmlReader instance pointed to by nativePointer |
abstract boolean |
hasFeature(java.lang.String name)
Returns true if the reader has the feature called name; otherwise returns false. |
abstract boolean |
hasProperty(java.lang.String name)
Returns true if the reader has the property name; otherwise returns false. |
abstract QXmlLexicalHandlerInterface |
lexicalHandler()
Returns the lexical handler or 0 if none was set. |
abstract boolean |
parse(QXmlInputSource input)
Reads an XML document from input and parses it. |
abstract void |
setContentHandler(QXmlContentHandlerInterface handler)
Sets the content handler to handler. |
abstract void |
setDeclHandler(QXmlDeclHandlerInterface handler)
Sets the declaration handler to handler. |
abstract void |
setDTDHandler(QXmlDTDHandlerInterface handler)
Sets the DTD handler to handler. |
abstract void |
setEntityResolver(QXmlEntityResolverInterface handler)
Sets the entity resolver to handler. |
abstract void |
setErrorHandler(QXmlErrorHandlerInterface handler)
Sets the error handler to handler. |
abstract void |
setFeature(java.lang.String name,
boolean value)
Sets the feature called name to the given value. |
abstract void |
setLexicalHandler(QXmlLexicalHandlerInterface handler)
Sets the lexical handler to handler. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QXmlReader()
Method Detail |
---|
public abstract QXmlDTDHandlerInterface DTDHandler()
Returns the DTD handler or 0 if none was set.
public abstract QXmlContentHandlerInterface contentHandler()
Returns the content handler or 0 if none was set.
public abstract QXmlDeclHandlerInterface declHandler()
Returns the declaration handler or 0 if none was set.
public abstract QXmlEntityResolverInterface entityResolver()
Returns the entity resolver or 0 if none was set.
public abstract QXmlErrorHandlerInterface errorHandler()
Returns the error handler or 0 if none is set.
public abstract boolean feature(java.lang.String name)
Equivalent to feature(name, 0).
public abstract boolean hasFeature(java.lang.String name)
Returns true if the reader has the feature called name; otherwise returns false.
public abstract boolean hasProperty(java.lang.String name)
Returns true if the reader has the property name; otherwise returns false.
public abstract QXmlLexicalHandlerInterface lexicalHandler()
Returns the lexical handler or 0 if none was set.
public abstract boolean parse(QXmlInputSource input)
Reads an XML document from input and parses it. Returns true if the parsing was successful; otherwise returns false.
public abstract void setContentHandler(QXmlContentHandlerInterface handler)
Sets the content handler to handler.
public abstract void setDTDHandler(QXmlDTDHandlerInterface handler)
Sets the DTD handler to handler.
public abstract void setDeclHandler(QXmlDeclHandlerInterface handler)
Sets the declaration handler to handler.
public abstract void setEntityResolver(QXmlEntityResolverInterface handler)
Sets the entity resolver to handler.
public abstract void setErrorHandler(QXmlErrorHandlerInterface handler)
Sets the error handler to handler. Clears the error handler if handler is 0.
public abstract void setFeature(java.lang.String name, boolean value)
Sets the feature called name to the given value. If the reader doesn't have the feature nothing happens.
public abstract void setLexicalHandler(QXmlLexicalHandlerInterface handler)
Sets the lexical handler to handler.
public static QXmlReader fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |