1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/xml/qxml.cpp:1207 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QXmlContentHandler Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QXmlContentHandler Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QXmlContentHandler class provides an interface to
|
---|
35 | report the logical content of XML data.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
|
---|
38 | <p><tt>#include <<a href="qxml-h.html">qxml.h</a>></tt>
|
---|
39 | <p>Inherited by <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a>.
|
---|
40 | <p><a href="qxmlcontenthandler-members.html">List of all member functions.</a>
|
---|
41 | <h2>Public Members</h2>
|
---|
42 | <ul>
|
---|
43 | <li class=fn>virtual void <a href="#setDocumentLocator"><b>setDocumentLocator</b></a> ( QXmlLocator * locator ) = 0</li>
|
---|
44 | <li class=fn>virtual bool <a href="#startDocument"><b>startDocument</b></a> () = 0</li>
|
---|
45 | <li class=fn>virtual bool <a href="#endDocument"><b>endDocument</b></a> () = 0</li>
|
---|
46 | <li class=fn>virtual bool <a href="#startPrefixMapping"><b>startPrefixMapping</b></a> ( const QString & prefix, const QString & uri ) = 0</li>
|
---|
47 | <li class=fn>virtual bool <a href="#endPrefixMapping"><b>endPrefixMapping</b></a> ( const QString & prefix ) = 0</li>
|
---|
48 | <li class=fn>virtual bool <a href="#startElement"><b>startElement</b></a> ( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ) = 0</li>
|
---|
49 | <li class=fn>virtual bool <a href="#endElement"><b>endElement</b></a> ( const QString & namespaceURI, const QString & localName, const QString & qName ) = 0</li>
|
---|
50 | <li class=fn>virtual bool <a href="#characters"><b>characters</b></a> ( const QString & ch ) = 0</li>
|
---|
51 | <li class=fn>virtual bool <a href="#ignorableWhitespace"><b>ignorableWhitespace</b></a> ( const QString & ch ) = 0</li>
|
---|
52 | <li class=fn>virtual bool <a href="#processingInstruction"><b>processingInstruction</b></a> ( const QString & target, const QString & data ) = 0</li>
|
---|
53 | <li class=fn>virtual bool <a href="#skippedEntity"><b>skippedEntity</b></a> ( const QString & name ) = 0</li>
|
---|
54 | <li class=fn>virtual QString <a href="#errorString"><b>errorString</b></a> () = 0</li>
|
---|
55 | </ul>
|
---|
56 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 | The QXmlContentHandler class provides an interface to
|
---|
61 | report the logical content of XML data.
|
---|
62 |
|
---|
63 | <p>
|
---|
64 |
|
---|
65 | <p> If the application needs to be informed of basic parsing events,
|
---|
66 | it can implement this interface and activate it using
|
---|
67 | <a href="qxmlreader.html#setContentHandler">QXmlReader::setContentHandler</a>(). The reader can then report basic
|
---|
68 | document-related events like the start and end of elements and
|
---|
69 | character data through this interface.
|
---|
70 | <p> The order of events in this interface is very important, and
|
---|
71 | mirrors the order of information in the document itself. For
|
---|
72 | example, all of an element's content (character data, processing
|
---|
73 | instructions, and sub-elements) appears, in order, between the
|
---|
74 | <a href="#startElement">startElement</a>() event and the corresponding <a href="#endElement">endElement</a>() event.
|
---|
75 | <p> The class <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a> provides a default implementation for
|
---|
76 | this interface; subclassing from the QXmlDefaultHandler class is
|
---|
77 | very convenient if you only want to be informed of some parsing
|
---|
78 | events.
|
---|
79 | <p> The <a href="#startDocument">startDocument</a>() function is called at the start of the
|
---|
80 | document, and <a href="#endDocument">endDocument</a>() is called at the end. Before parsing
|
---|
81 | begins <a href="#setDocumentLocator">setDocumentLocator</a>() is called. For each element
|
---|
82 | startElement() is called, with endElement() being called at the
|
---|
83 | end of each element. The <a href="#characters">characters</a>() function is called with
|
---|
84 | chunks of character data; <a href="#ignorableWhitespace">ignorableWhitespace</a>() is called with
|
---|
85 | chunks of whitespace and <a href="#processingInstruction">processingInstruction</a>() is called with
|
---|
86 | processing instructions. If an entity is skipped <a href="#skippedEntity">skippedEntity</a>()
|
---|
87 | is called. At the beginning of prefix-URI scopes
|
---|
88 | <a href="#startPrefixMapping">startPrefixMapping</a>() is called.
|
---|
89 | <p> See also the <a href="xml.html#sax2Intro">Introduction to SAX2</a>.
|
---|
90 | <p> <p>See also <a href="qxmldtdhandler.html">QXmlDTDHandler</a>, <a href="qxmldeclhandler.html">QXmlDeclHandler</a>, <a href="qxmlentityresolver.html">QXmlEntityResolver</a>, <a href="qxmlerrorhandler.html">QXmlErrorHandler</a>, <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a>, and <a href="xml-tools.html">XML</a>.
|
---|
91 |
|
---|
92 | <hr><h2>Member Function Documentation</h2>
|
---|
93 | <h3 class=fn>bool <a name="characters"></a>QXmlContentHandler::characters ( const <a href="qstring.html">QString</a> & ch )<tt> [pure virtual]</tt>
|
---|
94 | </h3>
|
---|
95 |
|
---|
96 | <p> The reader calls this function when it has parsed a chunk of
|
---|
97 | character data (either normal character data or character data
|
---|
98 | inside a CDATA section; if you need to distinguish between those
|
---|
99 | two types you must use <a href="qxmllexicalhandler.html#startCDATA">QXmlLexicalHandler::startCDATA</a>() and
|
---|
100 | <a href="qxmllexicalhandler.html#endCDATA">QXmlLexicalHandler::endCDATA</a>()). The character data is reported in
|
---|
101 | <em>ch</em>.
|
---|
102 | <p> Some readers report whitespace in element content using the
|
---|
103 | <a href="#ignorableWhitespace">ignorableWhitespace</a>() function rather than using this one.
|
---|
104 | <p> A reader may report the character data of an element in more than
|
---|
105 | one chunk; e.g. a reader might want to report "a<b" in three
|
---|
106 | <a href="#characters">characters</a>() events ("a ", "<" and " b").
|
---|
107 | <p> If this function returns FALSE the reader stops parsing and
|
---|
108 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
109 | get the error message.
|
---|
110 |
|
---|
111 | <h3 class=fn>bool <a name="endDocument"></a>QXmlContentHandler::endDocument ()<tt> [pure virtual]</tt>
|
---|
112 | </h3>
|
---|
113 |
|
---|
114 | <p> The reader calls this function after it has finished parsing. It
|
---|
115 | is called just once, and is the last handler function called. It
|
---|
116 | is called after the reader has read all input or has abandoned
|
---|
117 | parsing because of a fatal error.
|
---|
118 | <p> If this function returns FALSE the reader stops parsing and
|
---|
119 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
120 | get the error message.
|
---|
121 | <p> <p>See also <a href="#startDocument">startDocument</a>().
|
---|
122 |
|
---|
123 | <h3 class=fn>bool <a name="endElement"></a>QXmlContentHandler::endElement ( const <a href="qstring.html">QString</a> & namespaceURI, const <a href="qstring.html">QString</a> & localName, const <a href="qstring.html">QString</a> & qName )<tt> [pure virtual]</tt>
|
---|
124 | </h3>
|
---|
125 |
|
---|
126 | <p> The reader calls this function when it has parsed an end element
|
---|
127 | tag with the qualified name <em>qName</em>, the local name <em>localName</em>
|
---|
128 | and the namespace URI <em>namespaceURI</em>.
|
---|
129 | <p> If this function returns FALSE the reader stops parsing and
|
---|
130 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
131 | get the error message.
|
---|
132 | <p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
|
---|
133 | <p> <p>See also <a href="#startElement">startElement</a>().
|
---|
134 |
|
---|
135 | <p>Example: <a href="xml-sax-walkthrough.html#x2136">xml/tagreader/structureparser.cpp</a>.
|
---|
136 | <h3 class=fn>bool <a name="endPrefixMapping"></a>QXmlContentHandler::endPrefixMapping ( const <a href="qstring.html">QString</a> & prefix )<tt> [pure virtual]</tt>
|
---|
137 | </h3>
|
---|
138 |
|
---|
139 | <p> The reader calls this function to signal the end of a prefix
|
---|
140 | mapping for the prefix <em>prefix</em>.
|
---|
141 | <p> If this function returns FALSE the reader stops parsing and
|
---|
142 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
143 | get the error message.
|
---|
144 | <p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
|
---|
145 | <p> <p>See also <a href="#startPrefixMapping">startPrefixMapping</a>().
|
---|
146 |
|
---|
147 | <h3 class=fn><a href="qstring.html">QString</a> <a name="errorString"></a>QXmlContentHandler::errorString ()<tt> [pure virtual]</tt>
|
---|
148 | </h3>
|
---|
149 |
|
---|
150 | <p> The reader calls this function to get an error string, e.g. if any
|
---|
151 | of the handler functions returns FALSE.
|
---|
152 |
|
---|
153 | <h3 class=fn>bool <a name="ignorableWhitespace"></a>QXmlContentHandler::ignorableWhitespace ( const <a href="qstring.html">QString</a> & ch )<tt> [pure virtual]</tt>
|
---|
154 | </h3>
|
---|
155 |
|
---|
156 | <p> Some readers may use this function to report each chunk of
|
---|
157 | whitespace in element content. The whitespace is reported in <em>ch</em>.
|
---|
158 | <p> If this function returns FALSE the reader stops parsing and
|
---|
159 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
160 | get the error message.
|
---|
161 |
|
---|
162 | <h3 class=fn>bool <a name="processingInstruction"></a>QXmlContentHandler::processingInstruction ( const <a href="qstring.html">QString</a> & target, const <a href="qstring.html">QString</a> & data )<tt> [pure virtual]</tt>
|
---|
163 | </h3>
|
---|
164 |
|
---|
165 | <p> The reader calls this function when it has parsed a processing
|
---|
166 | instruction.
|
---|
167 | <p> <em>target</em> is the target name of the processing instruction and <em>data</em> is the data in the processing instruction.
|
---|
168 | <p> If this function returns FALSE the reader stops parsing and
|
---|
169 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
170 | get the error message.
|
---|
171 |
|
---|
172 | <h3 class=fn>void <a name="setDocumentLocator"></a>QXmlContentHandler::setDocumentLocator ( <a href="qxmllocator.html">QXmlLocator</a> * locator )<tt> [pure virtual]</tt>
|
---|
173 | </h3>
|
---|
174 |
|
---|
175 | <p> The reader calls this function before it starts parsing the
|
---|
176 | document. The argument <em>locator</em> is a pointer to a <a href="qxmllocator.html">QXmlLocator</a>
|
---|
177 | which allows the application to get the parsing position within
|
---|
178 | the document.
|
---|
179 | <p> Do not destroy the <em>locator</em>; it is destroyed when the reader is
|
---|
180 | destroyed. (Do not use the <em>locator</em> after the reader is
|
---|
181 | destroyed).
|
---|
182 |
|
---|
183 | <h3 class=fn>bool <a name="skippedEntity"></a>QXmlContentHandler::skippedEntity ( const <a href="qstring.html">QString</a> & name )<tt> [pure virtual]</tt>
|
---|
184 | </h3>
|
---|
185 |
|
---|
186 | <p> Some readers may skip entities if they have not seen the
|
---|
187 | declarations (e.g. because they are in an external DTD). If they
|
---|
188 | do so they report that they skipped the entity called <em>name</em> by
|
---|
189 | calling this function.
|
---|
190 | <p> If this function returns FALSE the reader stops parsing and
|
---|
191 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
192 | get the error message.
|
---|
193 |
|
---|
194 | <h3 class=fn>bool <a name="startDocument"></a>QXmlContentHandler::startDocument ()<tt> [pure virtual]</tt>
|
---|
195 | </h3>
|
---|
196 |
|
---|
197 | <p> The reader calls this function when it starts parsing the
|
---|
198 | document. The reader calls this function just once, after the call
|
---|
199 | to <a href="#setDocumentLocator">setDocumentLocator</a>(), and before any other functions in this
|
---|
200 | class or in the <a href="qxmldtdhandler.html">QXmlDTDHandler</a> class are called.
|
---|
201 | <p> If this function returns FALSE the reader stops parsing and
|
---|
202 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
203 | get the error message.
|
---|
204 | <p> <p>See also <a href="#endDocument">endDocument</a>().
|
---|
205 |
|
---|
206 | <p>Example: <a href="xml-sax-walkthrough.html#x2137">xml/tagreader/structureparser.cpp</a>.
|
---|
207 | <h3 class=fn>bool <a name="startElement"></a>QXmlContentHandler::startElement ( const <a href="qstring.html">QString</a> & namespaceURI, const <a href="qstring.html">QString</a> & localName, const <a href="qstring.html">QString</a> & qName, const <a href="qxmlattributes.html">QXmlAttributes</a> & atts )<tt> [pure virtual]</tt>
|
---|
208 | </h3>
|
---|
209 |
|
---|
210 | <p> The reader calls this function when it has parsed a start element
|
---|
211 | tag.
|
---|
212 | <p> There is a corresponding <a href="#endElement">endElement</a>() call when the corresponding
|
---|
213 | end element tag is read. The <a href="#startElement">startElement</a>() and endElement() calls
|
---|
214 | are always nested correctly. Empty element tags (e.g. <tt><x/></tt>)
|
---|
215 | cause a startElement() call to be immediately followed by an
|
---|
216 | endElement() call.
|
---|
217 | <p> The attribute list provided only contains attributes with explicit
|
---|
218 | values. The attribute list contains attributes used for namespace
|
---|
219 | declaration (i.e. attributes starting with xmlns) only if the
|
---|
220 | namespace-prefix property of the reader is TRUE.
|
---|
221 | <p> The argument <em>namespaceURI</em> is the namespace URI, or
|
---|
222 | <a href="qstring.html#QString-null">QString::null</a> if the element has no namespace URI or if no
|
---|
223 | namespace processing is done. <em>localName</em> is the local name
|
---|
224 | (without prefix), or QString::null if no namespace processing is
|
---|
225 | done, <em>qName</em> is the qualified name (with prefix) and <em>atts</em> are
|
---|
226 | the attributes attached to the element. If there are no
|
---|
227 | attributes, <em>atts</em> is an empty attributes object.
|
---|
228 | <p> If this function returns FALSE the reader stops parsing and
|
---|
229 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
230 | get the error message.
|
---|
231 | <p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
|
---|
232 | <p> <p>See also <a href="#endElement">endElement</a>().
|
---|
233 |
|
---|
234 | <p>Example: <a href="xml-sax-walkthrough.html#x2138">xml/tagreader/structureparser.cpp</a>.
|
---|
235 | <h3 class=fn>bool <a name="startPrefixMapping"></a>QXmlContentHandler::startPrefixMapping ( const <a href="qstring.html">QString</a> & prefix, const <a href="qstring.html">QString</a> & uri )<tt> [pure virtual]</tt>
|
---|
236 | </h3>
|
---|
237 |
|
---|
238 | <p> The reader calls this function to signal the begin of a prefix-URI
|
---|
239 | namespace mapping scope. This information is not necessary for
|
---|
240 | normal namespace processing since the reader automatically
|
---|
241 | replaces prefixes for element and attribute names.
|
---|
242 | <p> Note that <a href="#startPrefixMapping">startPrefixMapping</a>() and <a href="#endPrefixMapping">endPrefixMapping</a>() calls are
|
---|
243 | not guaranteed to be properly nested relative to each other: all
|
---|
244 | startPrefixMapping() events occur before the corresponding
|
---|
245 | <a href="#startElement">startElement</a>() event, and all endPrefixMapping() events occur
|
---|
246 | after the corresponding <a href="#endElement">endElement</a>() event, but their order is not
|
---|
247 | otherwise guaranteed.
|
---|
248 | <p> The argument <em>prefix</em> is the namespace prefix being declared and
|
---|
249 | the argument <em>uri</em> is the namespace URI the prefix is mapped to.
|
---|
250 | <p> If this function returns FALSE the reader stops parsing and
|
---|
251 | reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
|
---|
252 | get the error message.
|
---|
253 | <p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
|
---|
254 | <p> <p>See also <a href="#endPrefixMapping">endPrefixMapping</a>().
|
---|
255 |
|
---|
256 | <!-- eof -->
|
---|
257 | <hr><p>
|
---|
258 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
259 | Copyright © 1995-2007
|
---|
260 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
261 | <table width=100% cellspacing=0 border=0><tr>
|
---|
262 | <td>Copyright © 2007
|
---|
263 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
264 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
265 | </table></div></address></body>
|
---|
266 | </html>
|
---|