QXmlLexicalHandler Class Reference

[ QtXml module]

The QXmlLexicalHandler class provides an interface to report the lexical content of XML data. 更多...

Inherited by QXmlDefaultHandler .

方法


详细描述

The QXmlLexicalHandler class provides an interface to report the lexical content of XML data.

The events in the lexical handler apply to the entire document, not just to the document element, and all lexical handler events appear between the content handler's startDocument and endDocument 事件。

You can set the lexical handler with QXmlReader.setLexicalHandler ().

This interface's design is based on the SAX2 extension LexicalHandler.

The interface provides the startDTD (), endDTD (), startEntity (), endEntity (), startCDATA (), endCDATA () 和 comment () 函数。


方法文档编制

QXmlLexicalHandler.__init__ ( self )

QXmlLexicalHandler.__init__ ( self , QXmlLexicalHandler )

bool QXmlLexicalHandler.comment ( self , QString  ch )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report an XML comment anywhere in the document. It reports the text of the comment in ch .

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

bool QXmlLexicalHandler.endCDATA ( self )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report the end of a CDATA 章节。

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

另请参阅 startCDATA () 和 QXmlContentHandler.characters ().

bool QXmlLexicalHandler.endDTD ( self )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report the end of a DTD declaration, if any.

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

另请参阅 startDTD ().

bool QXmlLexicalHandler.endEntity ( self , QString  name )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report the end of an entity called name .

For every startEntity () call, there is a corresponding endEntity() call. The calls to startEntity () 和 endEntity() are properly nested.

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

另请参阅 startEntity (), QXmlContentHandler.skippedEntity (), and QXmlSimpleReader.setFeature ().

QString QXmlLexicalHandler.errorString ( self )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to get an error string if any of the handler functions returns false.

bool QXmlLexicalHandler.startCDATA ( self )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report the start of a CDATA section. The content of the CDATA section is reported through the QXmlContentHandler.characters () function. This function is intended only to report the boundary.

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

另请参阅 endCDATA ().

bool QXmlLexicalHandler.startDTD ( self , QString  name , QString  publicId , QString  systemId )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report the start of a DTD declaration, if any. It reports the name of the document type in name , the public identifier in publicId 和 system identifier in systemId .

If the public identifier is missing, publicId is set to an empty string. If the system identifier is missing, systemId is set to an empty string. Note that it is not valid XML to have a public identifier but no system identifier; in such cases a parse error will occur.

All declarations reported through QXmlDTDHandler or QXmlDeclHandler appear between the startDTD() and endDTD () calls.

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

另请参阅 endDTD ().

bool QXmlLexicalHandler.startEntity ( self , QString  name )

This method is abstract and should be reimplemented in any sub-class.

The reader calls this function to report the start of an entity called name .

Note that if the entity is unknown, the reader reports it through QXmlContentHandler.skippedEntity () and not through this function.

If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString () to get the error message.

另请参阅 endEntity () 和 QXmlSimpleReader.setFeature ().