📄 qxml.cpp
字号:
Destroys the content handler.*//*! \fn void QXmlContentHandler::setDocumentLocator(QXmlLocator* locator) The reader calls this function before it starts parsing the document. The argument \a locator is a pointer to a QXmlLocator which allows the application to get the parsing position within the document. Do not destroy the \a locator; it is destroyed when the reader is destroyed. (Do not use the \a locator after the reader is destroyed).*//*! \fn bool QXmlContentHandler::startDocument() The reader calls this function when it starts parsing the document. The reader calls this function just once, after the call to setDocumentLocator(), and before any other functions in this class or in the QXmlDTDHandler class are called. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message. \sa endDocument()*//*! \fn bool QXmlContentHandler::endDocument() The reader calls this function after it has finished parsing. It is called just once, and is the last handler function called. It is called after the reader has read all input or has abandoned parsing because of a fatal error. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message. \sa startDocument()*//*! \fn bool QXmlContentHandler::startPrefixMapping(const QString& prefix, const QString& uri) The reader calls this function to signal the begin of a prefix-URI namespace mapping scope. This information is not necessary for normal namespace processing since the reader automatically replaces prefixes for element and attribute names. Note that startPrefixMapping() and endPrefixMapping() calls are not guaranteed to be properly nested relative to each other: all startPrefixMapping() events occur before the corresponding startElement() event, and all endPrefixMapping() events occur after the corresponding endElement() event, but their order is not otherwise guaranteed. The argument \a prefix is the namespace prefix being declared and the argument \a uri is the namespace URI the prefix is mapped to. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message. \sa endPrefixMapping(), {Namespace Support via Features}*//*! \fn bool QXmlContentHandler::endPrefixMapping(const QString& prefix) The reader calls this function to signal the end of a prefix mapping for the prefix \a prefix. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message. \sa startPrefixMapping(), {Namespace Support via Features}*//*! \fn bool QXmlContentHandler::startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) The reader calls this function when it has parsed a start element tag. There is a corresponding endElement() call when the corresponding end element tag is read. The startElement() and endElement() calls are always nested correctly. Empty element tags (e.g. \c{<x/>}) cause a startElement() call to be immediately followed by an endElement() call. The attribute list provided only contains attributes with explicit values. The attribute list contains attributes used for namespace declaration (i.e. attributes starting with xmlns) only if the namespace-prefix property of the reader is true. The argument \a namespaceURI is the namespace URI, or an empty string if the element has no namespace URI or if no namespace processing is done. \a localName is the local name (without prefix), or an empty string if no namespace processing is done, \a qName is the qualified name (with prefix) and \a atts are the attributes attached to the element. If there are no attributes, \a atts is an empty attributes object. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message. \sa endElement(), {Namespace Support via Features}*//*! \fn bool QXmlContentHandler::endElement(const QString& namespaceURI, const QString& localName, const QString& qName) The reader calls this function when it has parsed an end element tag with the qualified name \a qName, the local name \a localName and the namespace URI \a namespaceURI. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message. \sa startElement(), {Namespace Support via Features}*//*! \fn bool QXmlContentHandler::characters(const QString& ch) The reader calls this function when it has parsed a chunk of character data (either normal character data or character data inside a CDATA section; if you need to distinguish between those two types you must use QXmlLexicalHandler::startCDATA() and QXmlLexicalHandler::endCDATA()). The character data is reported in \a ch. Some readers report whitespace in element content using the ignorableWhitespace() function rather than using this one. A reader may report the character data of an element in more than one chunk; e.g. a reader might want to report "a\<b" in three characters() events ("a ", "\<" and " b"). If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.*//*! \fn bool QXmlContentHandler::ignorableWhitespace(const QString& ch) Some readers may use this function to report each chunk of whitespace in element content. The whitespace is reported in \a 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.*//*! \fn bool QXmlContentHandler::processingInstruction(const QString& target, const QString& data) The reader calls this function when it has parsed a processing instruction. \a target is the target name of the processing instruction and \a data is the data in the processing instruction. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.*//*! \fn bool QXmlContentHandler::skippedEntity(const QString& name) Some readers may skip entities if they have not seen the declarations (e.g. because they are in an external DTD). If they do so they report that they skipped the entity called \a name by calling 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.*//*! \fn QString QXmlContentHandler::errorString() const The reader calls this function to get an error string, e.g. if any of the handler functions returns false.*//*! \class QXmlErrorHandler \reentrant \brief The QXmlErrorHandler class provides an interface to report errors in XML data. \module XML \ingroup xml-tools If you want your application to report errors to the user or to perform customized error handling, you should subclass this class. You can set the error handler with QXmlReader::setErrorHandler(). Errors can be reported using warning(), error() and fatalError(), with the error text being reported with errorString(). \sa QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, QXmlLexicalHandler, {Introduction to SAX2}*//*! \fn QXmlErrorHandler::~QXmlErrorHandler() Destroys the error handler.*//*! \fn bool QXmlErrorHandler::warning(const QXmlParseException& exception) A reader might use this function to report a warning. Warnings are conditions that are not errors or fatal errors as defined by the XML 1.0 specification. Details of the warning are stored in \a exception. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.*//*! \fn bool QXmlErrorHandler::error(const QXmlParseException& exception) A reader might use this function to report a recoverable error. A recoverable error corresponds to the definiton of "error" in section 1.2 of the XML 1.0 specification. Details of the error are stored in \a exception. The reader must continue to provide normal parsing events after invoking 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.*//*!\fn bool QXmlErrorHandler::fatalError(const QXmlParseException& exception)A reader must use this function to report a non-recoverable error.Details of the error are stored in \a exception.If this function returns true the reader might try to go onparsing and reporting further errors, but no regular parsingevents are reported.*//*! \fn QString QXmlErrorHandler::errorString() const The reader calls this function to get an error string if any of the handler functions returns false.*//*! \class QXmlDTDHandler \reentrant \brief The QXmlDTDHandler class provides an interface to report DTD content of XML data. \module XML \ingroup xml-tools If an application needs information about notations and unparsed entities, it can implement this interface and register an instance with QXmlReader::setDTDHandler(). Note that this interface includes only those DTD events that the XML recommendation requires processors to report, i.e. notation and unparsed entity declarations using notationDecl() and unparsedEntityDecl() respectively. \sa QXmlDeclHandler, QXmlContentHandler, QXmlEntityResolver, QXmlErrorHandler, QXmlLexicalHandler, {Introduction to SAX2}*//*! \fn QXmlDTDHandler::~QXmlDTDHandler() Destroys the DTD handler.*//*! \fn bool QXmlDTDHandler::notationDecl(const QString& name, const QString& publicId, const QString& systemId) The reader calls this function when it has parsed a notation declaration. The argument \a name is the notation name, \a publicId is the notation's public identifier and \a systemId is the notation's system identifier. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.*//*! \fn bool QXmlDTDHandler::unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) The reader calls this function when it finds an unparsed entity declaration. The argument \a name is the unparsed entity's name, \a publicId is the entity's public identifier, \a systemId is the entity's system identifier and \a notationName is the name of the associated notation. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.*//*! \fn QString QXmlDTDHandler::errorString() const The reader calls this function to get an error string if any of the handler functions returns false.*//*! \class QXmlEntityResolver \reentrant \brief The QXmlEntityResolver class provides an interface to resolve external entities contained in XML data. \module XML \ingroup xml-tools If an application needs to implement customized handling for external entities, it must implement this interface, i.e. resolveEntity(), and register it with QXmlReader::setEntityResolver(). \sa QXmlDTDHandler, QXmlDeclHandler, QXmlContentHandler, QXmlErrorHandler, QXmlLexicalHandler, {Introduction to SAX2}*//*! \fn QXmlEntityResolver::~QXmlEntityResolver() Destroys the entity resolver.*//*! \fn bool QXmlEntityResolver::resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) The reader calls this function before it opens any external entity, except the top-level document entity. The application may request the reader to resolve the entity itself (\a ret is 0) or to use an entirely different input source (\a ret points to the input source). The reader deletes the input source \a ret when it no longer needs it, so you should allocate it on the heap with \c new. The argument \a publicId is the public identifier of the external entity, \a systemId is the system identifier of the external entity and \a ret is the return value of this function. If \a ret is 0 the reader should resolve the entity itself, if it is non-zero it must point to an input source which the reader uses instead. If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.*//*! \fn QString QXmlEntityResolver::errorString() const The reader calls this function to get an error string if any of the handler functions returns false.*//*! \class QXmlLexicalHandler \reentrant \brief The QXmlLexicalHandler class provides an interface to report the lexical content of XML data. \module XML \ingroup xml-tools 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 the startDTD(), en
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -