summaryrefslogtreecommitdiffstats
path: root/doc/html/qxmlcontenthandler.html
blob: 3aeec131312f338cbab8abe411da0131f508838c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/xml/qxml.cpp:1207 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQXmlContentHandler Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQXmlContentHandler Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>

<p>The TQXmlContentHandler class provides an interface to
report the logical content of XML data.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include &lt;<a href="qxml-h.html">ntqxml.h</a>&gt;</tt>
<p>Inherited by <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a>.
<p><a href="qxmlcontenthandler-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>virtual void <a href="#setDocumentLocator"><b>setDocumentLocator</b></a> ( TQXmlLocator&nbsp;*&nbsp;locator ) = 0</li>
<li class=fn>virtual bool <a href="#startDocument"><b>startDocument</b></a> () = 0</li>
<li class=fn>virtual bool <a href="#endDocument"><b>endDocument</b></a> () = 0</li>
<li class=fn>virtual bool <a href="#startPrefixMapping"><b>startPrefixMapping</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;prefix, const&nbsp;TQString&nbsp;&amp;&nbsp;uri ) = 0</li>
<li class=fn>virtual bool <a href="#endPrefixMapping"><b>endPrefixMapping</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;prefix ) = 0</li>
<li class=fn>virtual bool <a href="#startElement"><b>startElement</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;TQString&nbsp;&amp;&nbsp;localName, const&nbsp;TQString&nbsp;&amp;&nbsp;qName, const&nbsp;TQXmlAttributes&nbsp;&amp;&nbsp;atts ) = 0</li>
<li class=fn>virtual bool <a href="#endElement"><b>endElement</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;TQString&nbsp;&amp;&nbsp;localName, const&nbsp;TQString&nbsp;&amp;&nbsp;qName ) = 0</li>
<li class=fn>virtual bool <a href="#characters"><b>characters</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;ch ) = 0</li>
<li class=fn>virtual bool <a href="#ignorableWhitespace"><b>ignorableWhitespace</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;ch ) = 0</li>
<li class=fn>virtual bool <a href="#processingInstruction"><b>processingInstruction</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;target, const&nbsp;TQString&nbsp;&amp;&nbsp;data ) = 0</li>
<li class=fn>virtual bool <a href="#skippedEntity"><b>skippedEntity</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name ) = 0</li>
<li class=fn>virtual TQString <a href="#errorString"><b>errorString</b></a> () = 0</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



The TQXmlContentHandler class provides an interface to
report the logical content of XML data.

<p> 

<p> If the application needs to be informed of basic parsing events,
it can implement this interface and activate it using
<a href="qxmlreader.html#setContentHandler">TQXmlReader::setContentHandler</a>(). The reader can then report basic
document-related events like the start and end of elements and
character data through this interface.
<p> The 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 sub-elements) appears, in order, between the
<a href="#startElement">startElement</a>() event and the corresponding <a href="#endElement">endElement</a>() event.
<p> The class <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a> provides a default implementation for
this interface; subclassing from the TQXmlDefaultHandler class is
very convenient if you only want to be informed of some parsing
events.
<p> The <a href="#startDocument">startDocument</a>() function is called at the start of the
document, and <a href="#endDocument">endDocument</a>() is called at the end. Before parsing
begins <a href="#setDocumentLocator">setDocumentLocator</a>() is called. For each element
startElement() is called, with endElement() being called at the
end of each element. The <a href="#characters">characters</a>() function is called with
chunks of character data; <a href="#ignorableWhitespace">ignorableWhitespace</a>() is called with
chunks of whitespace and <a href="#processingInstruction">processingInstruction</a>() is called with
processing instructions. If an entity is skipped <a href="#skippedEntity">skippedEntity</a>()
is called. At the beginning of prefix-URI scopes
<a href="#startPrefixMapping">startPrefixMapping</a>() is called.
<p> See also the <a href="xml.html#sax2Intro">Introduction to SAX2</a>.
<p> <p>See also <a href="qxmldtdhandler.html">TQXmlDTDHandler</a>, <a href="qxmldeclhandler.html">TQXmlDeclHandler</a>, <a href="qxmlentityresolver.html">TQXmlEntityResolver</a>, <a href="qxmlerrorhandler.html">TQXmlErrorHandler</a>, <a href="qxmllexicalhandler.html">TQXmlLexicalHandler</a>, and <a href="xml-tools.html">XML</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn>bool <a name="characters"></a>TQXmlContentHandler::characters ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;ch )<tt> [pure virtual]</tt>
</h3>

<p> 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 <a href="qxmllexicalhandler.html#startCDATA">TQXmlLexicalHandler::startCDATA</a>() and
<a href="qxmllexicalhandler.html#endCDATA">TQXmlLexicalHandler::endCDATA</a>()). The character data is reported in
<em>ch</em>.
<p> Some readers report whitespace in element content using the
<a href="#ignorableWhitespace">ignorableWhitespace</a>() function rather than using this one.
<p> A reader may report the character data of an element in more than
one chunk; e.g. a reader might want to report "a&lt;b" in three
<a href="#characters">characters</a>() events ("a ", "&lt;" and " b").
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.

<h3 class=fn>bool <a name="endDocument"></a>TQXmlContentHandler::endDocument ()<tt> [pure virtual]</tt>
</h3>

<p> 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.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> <p>See also <a href="#startDocument">startDocument</a>().

<h3 class=fn>bool <a name="endElement"></a>TQXmlContentHandler::endElement ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;localName, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;qName )<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function when it has parsed an end element
tag with the qualified name <em>qName</em>, the local name <em>localName</em>
and the namespace URI <em>namespaceURI</em>.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#startElement">startElement</a>().

<p>Example: <a href="xml-sax-walkthrough.html#x2136">xml/tagreader/structureparser.cpp</a>.
<h3 class=fn>bool <a name="endPrefixMapping"></a>TQXmlContentHandler::endPrefixMapping ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;prefix )<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function to signal the end of a prefix
mapping for the prefix <em>prefix</em>.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#startPrefixMapping">startPrefixMapping</a>().

<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="errorString"></a>TQXmlContentHandler::errorString ()<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function to get an error string, e.g. if any
of the handler functions returns FALSE.

<h3 class=fn>bool <a name="ignorableWhitespace"></a>TQXmlContentHandler::ignorableWhitespace ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;ch )<tt> [pure virtual]</tt>
</h3>

<p> Some readers may use this function to report each chunk of
whitespace in element content. The whitespace is reported in <em>ch</em>.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.

<h3 class=fn>bool <a name="processingInstruction"></a>TQXmlContentHandler::processingInstruction ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;target, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;data )<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function when it has parsed a processing
instruction.
<p> <em>target</em> is the target name of the processing instruction and <em>data</em> is the data in the processing instruction.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.

<h3 class=fn>void <a name="setDocumentLocator"></a>TQXmlContentHandler::setDocumentLocator ( <a href="qxmllocator.html">TQXmlLocator</a>&nbsp;*&nbsp;locator )<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function before it starts parsing the
document. The argument <em>locator</em> is a pointer to a <a href="qxmllocator.html">TQXmlLocator</a>
which allows the application to get the parsing position within
the document.
<p> Do not destroy the <em>locator</em>; it is destroyed when the reader is
destroyed. (Do not use the <em>locator</em> after the reader is
destroyed).

<h3 class=fn>bool <a name="skippedEntity"></a>TQXmlContentHandler::skippedEntity ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;name )<tt> [pure virtual]</tt>
</h3>

<p> 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 <em>name</em> by
calling this function.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.

<h3 class=fn>bool <a name="startDocument"></a>TQXmlContentHandler::startDocument ()<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function when it starts parsing the
document. The reader calls this function just once, after the call
to <a href="#setDocumentLocator">setDocumentLocator</a>(), and before any other functions in this
class or in the <a href="qxmldtdhandler.html">TQXmlDTDHandler</a> class are called.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> <p>See also <a href="#endDocument">endDocument</a>().

<p>Example: <a href="xml-sax-walkthrough.html#x2137">xml/tagreader/structureparser.cpp</a>.
<h3 class=fn>bool <a name="startElement"></a>TQXmlContentHandler::startElement ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;localName, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;qName, const&nbsp;<a href="qxmlattributes.html">TQXmlAttributes</a>&nbsp;&amp;&nbsp;atts )<tt> [pure virtual]</tt>
</h3>

<p> The reader calls this function when it has parsed a start element
tag.
<p> There is a corresponding <a href="#endElement">endElement</a>() call when the corresponding
end element tag is read. The <a href="#startElement">startElement</a>() and endElement() calls
are always nested correctly. Empty element tags (e.g. <tt>&lt;x/&gt;</tt>)
cause a startElement() call to be immediately followed by an
endElement() call.
<p> 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.
<p> The argument <em>namespaceURI</em> is the namespace URI, or
<a href="ntqstring.html#TQString-null">TQString::null</a> if the element has no namespace URI or if no
namespace processing is done. <em>localName</em> is the local name
(without prefix), or TQString::null if no namespace processing is
done, <em>qName</em> is the qualified name (with prefix) and <em>atts</em> are
the attributes attached to the element. If there are no
attributes, <em>atts</em> is an empty attributes object.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#endElement">endElement</a>().

<p>Example: <a href="xml-sax-walkthrough.html#x2138">xml/tagreader/structureparser.cpp</a>.
<h3 class=fn>bool <a name="startPrefixMapping"></a>TQXmlContentHandler::startPrefixMapping ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;prefix, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;uri )<tt> [pure virtual]</tt>
</h3>

<p> 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.
<p> Note that <a href="#startPrefixMapping">startPrefixMapping</a>() and <a href="#endPrefixMapping">endPrefixMapping</a>() calls are
not guaranteed to be properly nested relative to each other: all
startPrefixMapping() events occur before the corresponding
<a href="#startElement">startElement</a>() event, and all endPrefixMapping() events occur
after the corresponding <a href="#endElement">endElement</a>() event, but their order is not
otherwise guaranteed.
<p> The argument <em>prefix</em> is the namespace prefix being declared and
the argument <em>uri</em> is the namespace URI the prefix is mapped to.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#endPrefixMapping">endPrefixMapping</a>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>