|
|||||||||
| 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.QXmlDefaultHandler
public class QXmlDefaultHandler
The QXmlDefaultHandler class provides a default implementation of all the XML handler classes.
This class gathers together the features of the specialized handler classes, making it a convenient starting point when implementing custom handlers for subclasses of QXmlReader, particularly QXmlSimpleReader. The virtual functions from each of the base classes are reimplemented in this class, providing sensible default behavior for many common cases. By subclassing this class, and overriding these functions, you can concentrate on implementing the parts of the handler relevant to your application.
The XML reader must be told which handler to use for different kinds of events during parsing. This means that, although QXmlDefaultHandler provides default implementations of functions inherited from all its base classes, we can still use specialized handlers for particular kinds of events.
For example, QXmlDefaultHandler subclasses both QXmlContentHandler and QXmlErrorHandler, so by subclassing it we can use the same handler for both of the following reader functions:
xmlReader.setContentHandler(handler);
xmlReader.setErrorHandler(handler);
Since the reader will inform the handler of parsing errors, it is necessary to reimplement QXmlErrorHandler::fatalError() if, for example, we want to stop parsing when such an error occurs:
bool Handler::fatalError (const QXmlParseException & exception)
{
qWarning() << "Fatal error on line" << exception.lineNumber()
<< ", column" << exception.columnNumber() << ":"
<< exception.message();
return false;
}
The above function returns false, which tells the reader to stop parsing. To continue to use the same reader, it is necessary to create a new handler instance, and set up the reader to use it in the manner described above.
It is useful to examine some of the functions inherited by QXmlDefaultHandler, and consider why they might be reimplemented in a custom handler. Custom handlers will typically reimplement QXmlContentHandler::startDocument() to prepare the handler for new content. Document elements and the text within them can be processed by reimplementing QXmlContentHandler::startElement(), QXmlContentHandler::endElement(), and QXmlContentHandler::characters(). You may want to reimplement QXmlContentHandler::endDocument() to perform some finalization or validation on the content once the document has been read completely.
to SAX2| 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 | |
|---|---|
QXmlDefaultHandler()
Constructs a handler for use with subclasses of QXmlReader. |
|
| Method Summary | |
|---|---|
boolean |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
This function is reimplemented for internal reasons. |
boolean |
characters(java.lang.String ch)
This function is reimplemented for internal reasons. |
boolean |
comment(java.lang.String ch)
This function is reimplemented for internal reasons. |
boolean |
endCDATA()
This function is reimplemented for internal reasons. |
boolean |
endDocument()
This function is reimplemented for internal reasons. |
boolean |
endDTD()
This function is reimplemented for internal reasons. |
boolean |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
This function is reimplemented for internal reasons. |
boolean |
endEntity(java.lang.String name)
This function is reimplemented for internal reasons. |
boolean |
endPrefixMapping(java.lang.String prefix)
This function is reimplemented for internal reasons. |
boolean |
error(QXmlParseException exception)
This function is reimplemented for internal reasons. |
java.lang.String |
errorString()
This function is reimplemented for internal reasons. |
boolean |
externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
This function is reimplemented for internal reasons. |
boolean |
fatalError(QXmlParseException exception)
This function is reimplemented for internal reasons. |
static QXmlDefaultHandler |
fromNativePointer(QNativePointer nativePointer)
This function returns the QXmlDefaultHandler instance pointed to by nativePointer |
boolean |
ignorableWhitespace(java.lang.String ch)
This function is reimplemented for internal reasons. |
boolean |
internalEntityDecl(java.lang.String name,
java.lang.String value)
This function is reimplemented for internal reasons. |
boolean |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
This function is reimplemented for internal reasons. |
boolean |
processingInstruction(java.lang.String target,
java.lang.String data)
This function is reimplemented for internal reasons. |
boolean |
resolveEntity(java.lang.String publicId,
java.lang.String systemId,
QXmlInputSource ret)
This function is reimplemented for internal reasons. |
void |
setDocumentLocator(QXmlLocator locator)
This function is reimplemented for internal reasons. |
boolean |
skippedEntity(java.lang.String name)
This function is reimplemented for internal reasons. |
boolean |
startCDATA()
This function is reimplemented for internal reasons. |
boolean |
startDocument()
This function is reimplemented for internal reasons. |
boolean |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
This function is reimplemented for internal reasons. |
boolean |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
QXmlAttributes atts)
This function is reimplemented for internal reasons. |
boolean |
startEntity(java.lang.String name)
This function is reimplemented for internal reasons. |
boolean |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
This function is reimplemented for internal reasons. |
boolean |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
This function is reimplemented for internal reasons. |
boolean |
warning(QXmlParseException exception)
This function is reimplemented for internal reasons. |
| 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 |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Constructor Detail |
|---|
public QXmlDefaultHandler()
Constructs a handler for use with subclasses of QXmlReader.
| Method Detail |
|---|
public boolean attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
This function is reimplemented for internal reasons.
attributeDecl in interface QXmlDeclHandlerInterfacepublic boolean characters(java.lang.String ch)
This function is reimplemented for internal reasons.
characters in interface QXmlContentHandlerInterfacepublic boolean comment(java.lang.String ch)
This function is reimplemented for internal reasons.
comment in interface QXmlLexicalHandlerInterfacepublic boolean endCDATA()
This function is reimplemented for internal reasons.
endCDATA in interface QXmlLexicalHandlerInterfacepublic boolean endDTD()
This function is reimplemented for internal reasons.
endDTD in interface QXmlLexicalHandlerInterfacepublic boolean endDocument()
This function is reimplemented for internal reasons.
endDocument in interface QXmlContentHandlerInterface
public boolean endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
This function is reimplemented for internal reasons.
endElement in interface QXmlContentHandlerInterfaceSupport via Featurespublic boolean endEntity(java.lang.String name)
This function is reimplemented for internal reasons.
endEntity in interface QXmlLexicalHandlerInterfacepublic boolean endPrefixMapping(java.lang.String prefix)
This function is reimplemented for internal reasons.
endPrefixMapping in interface QXmlContentHandlerInterfaceSupport via Featurespublic boolean error(QXmlParseException exception)
This function is reimplemented for internal reasons.
error in interface QXmlErrorHandlerInterfacepublic java.lang.String errorString()
This function is reimplemented for internal reasons.
errorString in interface QXmlContentHandlerInterfaceerrorString in interface QXmlDeclHandlerInterfaceerrorString in interface QXmlDTDHandlerInterfaceerrorString in interface QXmlEntityResolverInterfaceerrorString in interface QXmlErrorHandlerInterfaceerrorString in interface QXmlLexicalHandlerInterface
public boolean externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
This function is reimplemented for internal reasons.
externalEntityDecl in interface QXmlDeclHandlerInterfacepublic boolean fatalError(QXmlParseException exception)
This function is reimplemented for internal reasons.
fatalError in interface QXmlErrorHandlerInterfacepublic boolean ignorableWhitespace(java.lang.String ch)
This function is reimplemented for internal reasons.
ignorableWhitespace in interface QXmlContentHandlerInterface
public boolean internalEntityDecl(java.lang.String name,
java.lang.String value)
This function is reimplemented for internal reasons.
internalEntityDecl in interface QXmlDeclHandlerInterface
public boolean notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
This function is reimplemented for internal reasons.
notationDecl in interface QXmlDTDHandlerInterface
public boolean processingInstruction(java.lang.String target,
java.lang.String data)
This function is reimplemented for internal reasons.
processingInstruction in interface QXmlContentHandlerInterface
public boolean resolveEntity(java.lang.String publicId,
java.lang.String systemId,
QXmlInputSource ret)
This function is reimplemented for internal reasons.
resolveEntity in interface QXmlEntityResolverInterfacepublic void setDocumentLocator(QXmlLocator locator)
This function is reimplemented for internal reasons.
setDocumentLocator in interface QXmlContentHandlerInterfacepublic boolean skippedEntity(java.lang.String name)
This function is reimplemented for internal reasons.
skippedEntity in interface QXmlContentHandlerInterfacepublic boolean startCDATA()
This function is reimplemented for internal reasons.
startCDATA in interface QXmlLexicalHandlerInterface
public boolean startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
This function is reimplemented for internal reasons.
startDTD in interface QXmlLexicalHandlerInterfacepublic boolean startDocument()
This function is reimplemented for internal reasons.
startDocument in interface QXmlContentHandlerInterface
public boolean startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
QXmlAttributes atts)
This function is reimplemented for internal reasons.
startElement in interface QXmlContentHandlerInterfaceSupport via Featurespublic boolean startEntity(java.lang.String name)
This function is reimplemented for internal reasons.
startEntity in interface QXmlLexicalHandlerInterface
public boolean startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
This function is reimplemented for internal reasons.
startPrefixMapping in interface QXmlContentHandlerInterfaceSupport via Features
public boolean unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
This function is reimplemented for internal reasons.
unparsedEntityDecl in interface QXmlDTDHandlerInterfacepublic boolean warning(QXmlParseException exception)
This function is reimplemented for internal reasons.
warning in interface QXmlErrorHandlerInterfacepublic static QXmlDefaultHandler 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 | ||||||||