📄 qxmlcontenthandler.3qt
字号:
'\" t.TH QXmlContentHandler 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQXmlContentHandler \- Interface to report logical content of XML data.br.PP\fC#include <qxml.h>\fR.PPInherited by QXmlDefaultHandler..PP.SS "Public Members".in +1c.ti -1c.BI "virtual void \fBsetDocumentLocator\fR ( QXmlLocator * locator ) ".br.ti -1c.BI "virtual bool \fBstartDocument\fR () ".br.ti -1c.BI "virtual bool \fBendDocument\fR () ".br.ti -1c.BI "virtual bool \fBstartPrefixMapping\fR ( const QString & " "prefix" ", const QString & uri ) ".br.ti -1c.BI "virtual bool \fBendPrefixMapping\fR ( const QString & prefix ) ".br.ti -1c.BI "virtual bool \fBstartElement\fR ( const QString & " "namespaceURI" ", const QString & " "localName" ", const QString & " "qName" ", const QXmlAttributes & atts ) ".br.ti -1c.BI "virtual bool \fBendElement\fR ( const QString & " "namespaceURI" ", const QString & " "localName" ", const QString & qName ) ".br.ti -1c.BI "virtual bool \fBcharacters\fR ( const QString & ch ) ".br.ti -1c.BI "virtual bool \fBignorableWhitespace\fR ( const QString & ch ) ".br.ti -1c.BI "virtual bool \fBprocessingInstruction\fR ( const QString & " "target" ", const QString & data ) ".br.ti -1c.BI "virtual bool \fBskippedEntity\fR ( const QString & name ) ".br.ti -1c.BI "virtual QString \fBerrorString\fR () ".br.in -1c.SH DESCRIPTIONThe QXmlContentHandler class provides an interface to report logical content of XML data..PPIf the application needs to be informed of basic parsing events, it implements this interface and sets it with QXmlReader::setContentHandler(). The reader reports basic document-related events like the start and end of elements and character data through this interface..PPThe order of events in this interface is very important, and mirrors the order of information in the document itself. For example, all of an element's content (character data, processing instructions, and/or subelements) will appear, in order, between the startElement() event and the corresponding endElement() event..PPThe class QXmlDefaultHandler gives a default implementation for this interface; subclassing from this class is very convenient if you want only be informed of some parsing events..PPSee also the Introduction to SAX2..PPSee also QXmlDTDHandler, QXmlDeclHandler, QXmlEntityResolver, QXmlErrorHandler and QXmlLexicalHandler..SH MEMBER FUNCTION DOCUMENTATION.SH "bool QXmlContentHandler::characters ( const QString & ch ) \fC[virtual]\fR"The reader calls this function when he has parsed a chunk of character data (either normal character data or character data inside a CDATA section; if you have to distinguish between those two types you have to use QXmlLexicalHandler::startCDATA() and QXmlLexicalHandler::endCDATA() in addition)..PPSome readers will report whitespace in element content using the ignorableWhitespace() function rather than this one (QXmlSimpleReader will do it not though)..PPA reader is allowed to 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")..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::endDocument () \fC[virtual]\fR"The reader calls this function after he has finished the parsing. It is only called once. It is the last function of all handler functions that is called. It is called after the reader has read all input or has abandoned parsing because of a fatal error..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPSee also startDocument()..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::endElement ( const QString & namespaceURI, const QString & localName, const QString & qName ) \fC[virtual]\fR"The reader calls this function when he has parsed an end element tag..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPSee also the namespace description..PPSee also startElement()..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::endPrefixMapping ( const QString & prefix ) \fC[virtual]\fR"The reader calls this function to signal the end of a prefix mapping..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPSee also the namespace description..PPSee also startPrefixMapping()..PPReimplemented in QXmlDefaultHandler..SH "QString QXmlContentHandler::errorString () \fC[virtual]\fR"The reader calls this function to get an error string if any of the handler functions returns FALSE to him..SH "bool QXmlContentHandler::ignorableWhitespace ( const QString & ch ) \fC[virtual]\fR"Some readers may use this function to report each chunk of whitespace in element content (QXmlSimpleReader does not though)..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::processingInstruction ( const QString & target, const QString & data ) \fC[virtual]\fR"The reader calls this function when he has parsed a processing instruction..PP\fItarget\fR is the target name of the processing instruction and \fIdata\fR is the data of the processing instruction..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPReimplemented in QXmlDefaultHandler..SH "void QXmlContentHandler::setDocumentLocator ( QXmlLocator * locator ) \fC[virtual]\fR"The reader calls this function before he starts parsing the document. The argument \fIlocator\fR is a pointer to a QXmlLocator which allows the application to get the actual position of the parsing in the document..PPDo not destroy the \fIlocator;\fR it is destroyed when the reader is destroyed (do not use the \fIlocator\fR after the reader got destroyed)..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::skippedEntity ( const QString & name ) \fC[virtual]\fR"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 will report it by calling this function..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::startDocument () \fC[virtual]\fR"The reader calls this function when he starts parsing the document. The reader will call this function only once before any other functions in this class or in the QXmlDTDHandler class are called (except QXmlContentHandler::setDocumentLocator())..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPSee also endDocument()..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::startElement ( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ) \fC[virtual]\fR"The reader calls this function when he has parsed a start element tag..PPThere will be a corresponding endElement() call when the corresponding end element tag was read. The startElement() and endElement() calls are always nested correctly. Empty element tags (e.g. <a/>) are reported by startElement() directly followed by a call to endElement()..PPThe attribute list provided will contain only attributes with explicit values. The attribute list will contain attributes used for namespace declaration (i.e. attributes starting with xmlns) only if the namespace-prefix property of the reader is TRUE..PPThe argument \fIuri\fR is the namespace URI, or the empty string if the element has no namespace URI or if namespace processing is not being performed, \fIlocalName\fR is the local name (without prefix), or the empty string if namespace processing is not being performed, \fIqName\fR is the qualified name (with prefix), or the empty string if qualified names are not available and \fIatts\fR are the attributes attached to the element. If there are no attributes, \fIatts\fR is an empty attributes object.PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPSee also the namespace description..PPSee also endElement()..PPReimplemented in QXmlDefaultHandler..SH "bool QXmlContentHandler::startPrefixMapping ( const QString & prefix, const QString & uri ) \fC[virtual]\fR"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..PPNote that startPrefixMapping and endPrefixMapping calls are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not otherwise guaranteed..PPThe argument \fIprefix\fR is the namespace prefix being declared and the argument \fIuri\fR is the namespace URI the prefix is mapped to..PPIf this function returns FALSE the reader will stop parsing and will report an error. The reader will use the function errorString() to get the error message that will be used for reporting the error..PPSee also the namespace description..PPSee also endPrefixMapping()..PPReimplemented in QXmlDefaultHandler..SH "SEE ALSO".BR http://doc.trolltech.com/qxmlcontenthandler.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qxmlcontenthandler.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -