QXmlLexicalHandler¶
The
QXmlLexicalHandler
class provides an interface to report the lexical content of XML data. More…
Detailed Description¶
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 events.
You can set the lexical handler with
setLexicalHandler()
.This interface’s design is based on the SAX2 extension LexicalHandler.
The interface provides the
startDTD()
,endDTD()
,startEntity()
,endEntity()
,startCDATA()
,endCDATA()
andcomment()
functions.
- class PySide2.QtXml.QXmlLexicalHandler¶
- PySide2.QtXml.QXmlLexicalHandler.comment(ch)¶
- Parameters:
ch – str
- Return type:
bool
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 functionerrorString()
to get the error message.
- PySide2.QtXml.QXmlLexicalHandler.endCDATA()¶
- Return type:
bool
The reader calls this function to report the end of a CDATA section.
If this function returns
false
the reader stops parsing and reports an error. The reader uses the functionerrorString()
to get the error message.See also
- PySide2.QtXml.QXmlLexicalHandler.endDTD()¶
- Return type:
bool
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 functionerrorString()
to get the error message.See also
- PySide2.QtXml.QXmlLexicalHandler.endEntity(name)¶
- Parameters:
name – str
- Return type:
bool
The reader calls this function to report the end of an entity called
name
.For every
startEntity()
call, there is a corresponding call. The calls tostartEntity()
and are properly nested.If this function returns
false
the reader stops parsing and reports an error. The reader uses the functionerrorString()
to get the error message.See also
startEntity()
skippedEntity()
setFeature()
- PySide2.QtXml.QXmlLexicalHandler.errorString()¶
- Return type:
str
The reader calls this function to get an error string if any of the handler functions returns
false
.
- PySide2.QtXml.QXmlLexicalHandler.startCDATA()¶
- Return type:
bool
The reader calls this function to report the start of a CDATA section. The content of the CDATA section is reported through the
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 functionerrorString()
to get the error message.See also
- PySide2.QtXml.QXmlLexicalHandler.startDTD(name, publicId, systemId)¶
- Parameters:
name – str
publicId – str
systemId – str
- Return type:
bool
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 inpublicId
and the system identifier insystemId
.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
orQXmlDeclHandler
appear between the andendDTD()
calls.If this function returns
false
the reader stops parsing and reports an error. The reader uses the functionerrorString()
to get the error message.See also
- PySide2.QtXml.QXmlLexicalHandler.startEntity(name)¶
- Parameters:
name – str
- Return type:
bool
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
skippedEntity()
and not through this function.If this function returns
false
the reader stops parsing and reports an error. The reader uses the functionerrorString()
to get the error message.See also
endEntity()
setFeature()
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.