QXmlLexicalHandler 类提供用于报告 XML 数据词法内容的接口。 更多...
头: | #include <QXmlLexicalHandler> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat) |
qmake: | QT += core5compat |
继承者: | QXmlDefaultHandler |
注意: 此类的所有函数 可重入 .
virtual | ~QXmlLexicalHandler () |
virtual bool | comment (const QString & ch ) = 0 |
virtual bool | endCDATA () = 0 |
virtual bool | endDTD () = 0 |
virtual bool | endEntity (const QString & name ) = 0 |
virtual QString | errorString () const = 0 |
virtual bool | startCDATA () = 0 |
virtual bool | startDTD (const QString & name , const QString & publicId , const QString & systemId ) = 0 |
virtual bool | startEntity (const QString & name ) = 0 |
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 QXmlReader::setLexicalHandler ().
This interface's design is based on the SAX2 extension LexicalHandler.
The interface provides the startDTD (), endDTD (), startEntity (), endEntity (), startCDATA (), endCDATA () 和 comment () 函数。
另请参阅 QXmlDTDHandler , QXmlDeclHandler , QXmlContentHandler , QXmlEntityResolver ,和 QXmlErrorHandler .
[虚拟]
QXmlLexicalHandler::
~QXmlLexicalHandler
()
Destroys the lexical handler.
[pure virtual]
bool
QXmlLexicalHandler::
comment
(const
QString
&
ch
)
The reader calls this function to report an XML comment anywhere in the document. It reports the text of the comment in ch .
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
[pure virtual]
bool
QXmlLexicalHandler::
endCDATA
()
The reader calls this function to report the end of a CDATA section.
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
另请参阅 startCDATA () 和 QXmlContentHandler::characters ().
[pure virtual]
bool
QXmlLexicalHandler::
endDTD
()
The reader calls this function to report the end of a DTD declaration, if any.
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
另请参阅 startDTD ().
[pure virtual]
bool
QXmlLexicalHandler::
endEntity
(const
QString
&
name
)
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 () and endEntity() are properly nested.
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
另请参阅 startEntity (), QXmlContentHandler::skippedEntity (),和 QXmlSimpleReader::setFeature ().
[pure virtual]
QString
QXmlLexicalHandler::
errorString
() const
The reader calls this function to get an error string if any of the handler functions returns
false
.
[pure virtual]
bool
QXmlLexicalHandler::
startCDATA
()
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.
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
另请参阅 endCDATA ().
[pure virtual]
bool
QXmlLexicalHandler::
startDTD
(const
QString
&
name
, const
QString
&
publicId
, const
QString
&
systemId
)
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 and the 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 () 调用。
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
另请参阅 endDTD ().
[pure virtual]
bool
QXmlLexicalHandler::
startEntity
(const
QString
&
name
)
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.
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
另请参阅 endEntity () 和 QXmlSimpleReader::setFeature ().