Qt Jambi Home

com.trolltech.qt.xml
Class QXmlReader

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.xml.QXmlReader
All Implemented Interfaces:
QtJambiInterface
Direct Known Subclasses:
QXmlSimpleReader

public abstract class QXmlReader
extends QtJambiObject

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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
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

QXmlReader

public QXmlReader()
Creates a new QXmlReader.

Method Detail

DTDHandler

public abstract QXmlDTDHandlerInterface DTDHandler()

Returns the DTD handler or 0 if none was set.

See Also:
setDTDHandler

contentHandler

public abstract QXmlContentHandlerInterface contentHandler()

Returns the content handler or 0 if none was set.

See Also:
setContentHandler

declHandler

public abstract QXmlDeclHandlerInterface declHandler()

Returns the declaration handler or 0 if none was set.

See Also:
setDeclHandler

entityResolver

public abstract QXmlEntityResolverInterface entityResolver()

Returns the entity resolver or 0 if none was set.

See Also:
setEntityResolver

errorHandler

public abstract QXmlErrorHandlerInterface errorHandler()

Returns the error handler or 0 if none is set.

See Also:
setErrorHandler

feature

public abstract boolean feature(java.lang.String name)

Equivalent to feature(name, 0).

See Also:
setFeature

hasFeature

public abstract boolean hasFeature(java.lang.String name)

Returns true if the reader has the feature called name; otherwise returns false.

See Also:
feature, setFeature

hasProperty

public abstract boolean hasProperty(java.lang.String name)

Returns true if the reader has the property name; otherwise returns false.

See Also:
property, setProperty

lexicalHandler

public abstract QXmlLexicalHandlerInterface lexicalHandler()

Returns the lexical handler or 0 if none was set.

See Also:
setLexicalHandler

parse

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.


setContentHandler

public abstract void setContentHandler(QXmlContentHandlerInterface handler)

Sets the content handler to handler.

See Also:
contentHandler

setDTDHandler

public abstract void setDTDHandler(QXmlDTDHandlerInterface handler)

Sets the DTD handler to handler.

See Also:
DTDHandler

setDeclHandler

public abstract void setDeclHandler(QXmlDeclHandlerInterface handler)

Sets the declaration handler to handler.

See Also:
declHandler

setEntityResolver

public abstract void setEntityResolver(QXmlEntityResolverInterface handler)

Sets the entity resolver to handler.

See Also:
entityResolver

setErrorHandler

public abstract void setErrorHandler(QXmlErrorHandlerInterface handler)

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

See Also:
errorHandler

setFeature

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.

See Also:
feature, hasFeature

setLexicalHandler

public abstract void setLexicalHandler(QXmlLexicalHandlerInterface handler)

Sets the lexical handler to handler.

See Also:
lexicalHandler

fromNativePointer

public static QXmlReader fromNativePointer(QNativePointer nativePointer)
This function returns the QXmlReader instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home