Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtXml.QXmlDefaultHandler Class Reference

The QXmlDefaultHandler class provides a default implementation of all the XML handler classes. More...

Inheritance diagram for QtXml.QXmlDefaultHandler:
Collaboration diagram for QtXml.QXmlDefaultHandler:

Public Member Functions

 QXmlDefaultHandler ()
 
 
override void CreateProxy ()
 
virtual bool AttributeDecl (string eName, string aName, string type, string valueDefault, string value)
 
 
override bool Characters (string ch)
 
 
virtual bool Comment (string ch)
 
 
virtual bool EndCDATA ()
 
 
virtual bool EndDTD ()
 
 
override bool EndDocument ()
 
 
override bool EndElement (string namespaceURI, string localName, string qName)
 
 
virtual bool EndEntity (string name)
 
 
override bool EndPrefixMapping (string prefix)
 
 
virtual bool Error (QXmlParseException exception)
 
 
override string ErrorString ()
 
 
virtual bool ExternalEntityDecl (string name, string publicId, string systemId)
 
 
virtual bool FatalError (QXmlParseException exception)
 
 
override bool IgnorableWhitespace (string ch)
 
 
virtual bool InternalEntityDecl (string name, string value)
 
 
virtual bool NotationDecl (string name, string publicId, string systemId)
 
 
override bool ProcessingInstruction (string target, string data)
 
 
virtual bool ResolveEntity (string publicId, string systemId, QXmlInputSource ret)
 
 
override void SetDocumentLocator (QXmlLocator locator)
 
 
override bool SkippedEntity (string name)
 
 
virtual bool StartCDATA ()
 
 
virtual bool StartDTD (string name, string publicId, string systemId)
 
 
override bool StartDocument ()
 
 
override bool StartElement (string namespaceURI, string localName, string qName, QXmlAttributes atts)
 
 
virtual bool StartEntity (string name)
 
 
override bool StartPrefixMapping (string prefix, string uri)
 
 
virtual bool UnparsedEntityDecl (string name, string publicId, string systemId, string notationName)
 
 
virtual bool Warning (QXmlParseException exception)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtXml.QXmlContentHandler
 QXmlContentHandler ()
 
 QXmlContentHandler (QXmlContentHandler copy)
 
new void Dispose ()
 
- Public Member Functions inherited from QtXml.IQXmlErrorHandler
bool Error (QXmlParseException exception)
 
string ErrorString ()
 
bool FatalError (QXmlParseException exception)
 
bool Warning (QXmlParseException exception)
 
- Public Member Functions inherited from QtXml.IQXmlDTDHandler
string ErrorString ()
 
bool NotationDecl (string name, string publicId, string systemId)
 
bool UnparsedEntityDecl (string name, string publicId, string systemId, string notationName)
 
- Public Member Functions inherited from QtXml.IQXmlEntityResolver
string ErrorString ()
 
bool ResolveEntity (string publicId, string systemId, QXmlInputSource ret)
 
- Public Member Functions inherited from QtXml.IQXmlLexicalHandler
bool Comment (string ch)
 
bool EndCDATA ()
 
bool EndDTD ()
 
bool EndEntity (string name)
 
string ErrorString ()
 
bool StartCDATA ()
 
bool StartDTD (string name, string publicId, string systemId)
 
bool StartEntity (string name)
 
- Public Member Functions inherited from QtXml.IQXmlDeclHandler
bool AttributeDecl (string eName, string aName, string type, string valueDefault, string value)
 
string ErrorString ()
 
bool ExternalEntityDecl (string name, string publicId, string systemId)
 
bool InternalEntityDecl (string name, string value)
 

Protected Member Functions

 QXmlDefaultHandler (System.Type dummy)
 
- Protected Member Functions inherited from QtXml.QXmlContentHandler
 QXmlContentHandler (System.Type dummy)
 

Additional Inherited Members

- Protected Attributes inherited from QtXml.QXmlContentHandler
SmokeInvocation interceptor
 
- Properties inherited from QtXml.QXmlContentHandler
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

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.

See also QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler, QXmlLexicalHandler, and Introduction to SAX2.

Constructor & Destructor Documentation

QtXml.QXmlDefaultHandler.QXmlDefaultHandler ( System.Type  dummy)
protected
QtXml.QXmlDefaultHandler.QXmlDefaultHandler ( )

Constructs a handler for use with subclasses of QXmlReader.

Member Function Documentation

virtual bool QtXml.QXmlDefaultHandler.AttributeDecl ( string  eName,
string  aName,
string  type,
string  valueDefault,
string  value 
)
virtual

Reimplemented from QXmlDeclHandler::attributeDecl().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.Characters ( string  ch)
virtual

Reimplemented from QXmlContentHandler::characters().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.Comment ( string  ch)
virtual

Reimplemented from QXmlLexicalHandler::comment().

This reimplementation does nothing.

override void QtXml.QXmlDefaultHandler.CreateProxy ( )
virtual

Reimplemented from QtXml.QXmlContentHandler.

new void QtXml.QXmlDefaultHandler.Dispose ( )
virtual bool QtXml.QXmlDefaultHandler.EndCDATA ( )
virtual

Reimplemented from QXmlLexicalHandler::endCDATA().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.EndDocument ( )
virtual

Reimplemented from QXmlContentHandler::endDocument().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.EndDTD ( )
virtual

Reimplemented from QXmlLexicalHandler::endDTD().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.EndElement ( string  namespaceURI,
string  localName,
string  qName 
)
virtual

Reimplemented from QXmlContentHandler::endElement().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.EndEntity ( string  name)
virtual

Reimplemented from QXmlLexicalHandler::endEntity().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.EndPrefixMapping ( string  prefix)
virtual

Reimplemented from QXmlContentHandler::endPrefixMapping().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.Error ( QXmlParseException  exception)
virtual

Reimplemented from QXmlErrorHandler::error().

This reimplementation does nothing.

override string QtXml.QXmlDefaultHandler.ErrorString ( )
virtual

Reimplemented from QXmlContentHandler::errorString().

Returns the default error string.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.ExternalEntityDecl ( string  name,
string  publicId,
string  systemId 
)
virtual

Reimplemented from QXmlDeclHandler::externalEntityDecl().

This reimplementation does nothing.

virtual bool QtXml.QXmlDefaultHandler.FatalError ( QXmlParseException  exception)
virtual

Reimplemented from QXmlErrorHandler::fatalError().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.IgnorableWhitespace ( string  ch)
virtual

Reimplemented from QXmlContentHandler::ignorableWhitespace().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.InternalEntityDecl ( string  name,
string  value 
)
virtual

Reimplemented from QXmlDeclHandler::internalEntityDecl().

This reimplementation does nothing.

virtual bool QtXml.QXmlDefaultHandler.NotationDecl ( string  name,
string  publicId,
string  systemId 
)
virtual

Reimplemented from QXmlDTDHandler::notationDecl().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.ProcessingInstruction ( string  target,
string  data 
)
virtual

Reimplemented from QXmlContentHandler::processingInstruction().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.ResolveEntity ( string  publicId,
string  systemId,
QXmlInputSource  ret 
)
virtual

Reimplemented from QXmlEntityResolver::resolveEntity().

Sets ret to 0, so that the reader uses the system identifier provided in the XML document.

override void QtXml.QXmlDefaultHandler.SetDocumentLocator ( QXmlLocator  locator)
virtual

Reimplemented from QXmlContentHandler::setDocumentLocator().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

override bool QtXml.QXmlDefaultHandler.SkippedEntity ( string  name)
virtual

Reimplemented from QXmlContentHandler::skippedEntity().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.StartCDATA ( )
virtual

Reimplemented from QXmlLexicalHandler::startCDATA().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.StartDocument ( )
virtual

Reimplemented from QXmlContentHandler::startDocument().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.StartDTD ( string  name,
string  publicId,
string  systemId 
)
virtual

Reimplemented from QXmlLexicalHandler::startDTD().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.StartElement ( string  namespaceURI,
string  localName,
string  qName,
QXmlAttributes  atts 
)
virtual

Reimplemented from QXmlContentHandler::startElement().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.StartEntity ( string  name)
virtual

Reimplemented from QXmlLexicalHandler::startEntity().

This reimplementation does nothing.

override bool QtXml.QXmlDefaultHandler.StartPrefixMapping ( string  prefix,
string  uri 
)
virtual

Reimplemented from QXmlContentHandler::startPrefixMapping().

This reimplementation does nothing.

Implements QtXml.QXmlContentHandler.

virtual bool QtXml.QXmlDefaultHandler.UnparsedEntityDecl ( string  name,
string  publicId,
string  systemId,
string  notationName 
)
virtual

Reimplemented from QXmlDTDHandler::unparsedEntityDecl().

This reimplementation does nothing.

virtual bool QtXml.QXmlDefaultHandler.Warning ( QXmlParseException  exception)
virtual

Reimplemented from QXmlErrorHandler::warning().

This reimplementation does nothing.