返回介绍

QXmlLexicalHandler Class

发布于 2019-10-04 15:04:17 字数 5313 浏览 954 评论 0 收藏 0

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

#include <qxml.h>

Inherited by QXmlDefaultHandler.

List of all member functions.

Public Members

  • virtual bool startDTD ( constQString&name, constQString&publicId, constQString&systemId ) = 0
  • virtual bool endDTD () = 0
  • virtual bool startEntity ( constQString&name ) = 0
  • virtual bool endEntity ( constQString&name ) = 0
  • virtual bool startCDATA () = 0
  • virtual bool endCDATA () = 0
  • virtual bool comment ( constQString&ch ) = 0
  • virtual QString errorString () = 0

Detailed Description

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 events.

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

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

The interface provides startDTD(), endDTD(), startEntity(), endEntity(), startCDATA(), endCDATA() and comment() functions.

See also the Introduction to SAX2.

See also QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler and XML.


Member Function Documentation

bool QXmlLexicalHandler::comment ( constQString&ch ) [pure virtual]

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 () [pure virtual]

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 function errorString() to get the error message.

See also startCDATA().

bool QXmlLexicalHandler::endDTD () [pure virtual]

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.

See also startDTD().

bool QXmlLexicalHandler::endEntity ( constQString&name ) [pure virtual]

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

For every call of startEntity(), there is a corresponding call of endEntity(). The calls of startEntity() and 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.

See also startEntity() and QXmlSimpleReader::setFeature().

QString QXmlLexicalHandler::errorString () [pure virtual]

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

bool QXmlLexicalHandler::startCDATA () [pure virtual]

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.

See also endCDATA().

bool QXmlLexicalHandler::startDTD ( constQString&name, constQString&publicId, constQString&systemId ) [pure virtual]

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 and the system identifier is missing, the reader sets the publicId and systemId to QString::null.

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.

See also endDTD().

bool QXmlLexicalHandler::startEntity ( constQString&name ) [pure virtual]

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

Note that if the entity is unknown, the reader reports it through QXmlContentHandler::skippedEntity() and not throught 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.

See also endEntity() and QXmlSimpleReader::setFeature().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文