summaryrefslogtreecommitdiffstats
path: root/doc/html/tqxmlsimplereader.html
blob: 456a1cd8275c1f9bcb504617f95c978724972308 (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
<!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/tqxml.cpp:2568 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQXmlSimpleReader 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>TQXmlSimpleReader Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>

<p>The TQXmlSimpleReader class provides an implementation of a
simple XML reader (parser).
<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="tqxml-h.html">tqxml.h</a>&gt;</tt>
<p>Inherits <a href="tqxmlreader.html">TQXmlReader</a>.
<p><a href="tqxmlsimplereader-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQXmlSimpleReader"><b>TQXmlSimpleReader</b></a> ()</li>
<li class=fn>virtual <a href="#~TQXmlSimpleReader"><b>~TQXmlSimpleReader</b></a> ()</li>
<li class=fn>virtual void <a href="#setFeature"><b>setFeature</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name, bool&nbsp;value )</li>
<li class=fn>virtual bool <a href="#parse"><b>parse</b></a> ( const&nbsp;TQXmlInputSource&nbsp;*&nbsp;input, bool&nbsp;incremental )</li>
<li class=fn>virtual bool <a href="#parseContinue"><b>parseContinue</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



The TQXmlSimpleReader class provides an implementation of a
simple XML reader (parser).

<p> 


<p> This XML reader is sufficient for simple parsing tasks. The reader:
<ul>
<li> provides a well-formed parser;
<li> does not parse any external entities;
<li> can do namespace processing.
</ul>
<p> Documents are parsed with a call to <a href="#parse">parse</a>().
<p> <p>See also <a href="xml-tools.html">XML</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQXmlSimpleReader"></a>TQXmlSimpleReader::TQXmlSimpleReader ()
</h3>
Constructs a simple XML reader with the following feature settings:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Feature <th valign="top">Setting
<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://xml.org/sax/features/namespaces</em> <td valign="top">TRUE
<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://xml.org/sax/features/namespace-prefixes</em> <td valign="top">FALSE
<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://trolltech.com/xml/features/report-whitespace-only-CharData</em>
<td valign="top">TRUE
<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://trolltech.com/xml/features/report-start-end-entity</em> <td valign="top">FALSE
</table></center>
<p> More information about features can be found in the <a href="xml.html#sax2Features">TQt SAX2 overview.</a>
<p> <p>See also <a href="#setFeature">setFeature</a>().

<h3 class=fn><a name="~TQXmlSimpleReader"></a>TQXmlSimpleReader::~TQXmlSimpleReader ()<tt> [virtual]</tt>
</h3>
Destroys the simple XML reader.

<h3 class=fn>bool <a name="parse"></a>TQXmlSimpleReader::parse ( const&nbsp;<a href="tqxmlinputsource.html">TQXmlInputSource</a>&nbsp;*&nbsp;input, bool&nbsp;incremental )<tt> [virtual]</tt>
</h3>
Reads an XML document from <em>input</em> and parses it. Returns FALSE
if the parsing detects an error; otherwise returns TRUE.
<p> If <em>incremental</em> is TRUE, the parser does not return FALSE when
it reaches the end of the <em>input</em> without reaching the end of the
XML file. Instead it stores the state of the parser so that
parsing can be continued at a later stage when more data is
available. You can use the function <a href="#parseContinue">parseContinue</a>() to continue
with parsing. This class stores a pointer to the input source <em>input</em> and the parseContinue() function tries to read from that
input souce. This means that you should not delete the input
source <em>input</em> until you've finished your calls to
parseContinue(). If you call this function with <em>incremental</em>
TRUE whilst an incremental parse is in progress a new parsing
session will be started and the previous session lost.
<p> If <em>incremental</em> is FALSE, this function behaves like the normal
parse function, i.e. it returns FALSE when the end of input is
reached without reaching the end of the XML file and the parsing
cannot be continued.
<p> <p>See also <a href="#parseContinue">parseContinue</a>() and <a href="ntqsocket.html">TQSocket</a>.

<p>Examples: <a href="tagreader-with-features-example.html#x1976">xml/tagreader-with-features/tagreader.cpp</a> and <a href="tagreader-example.html#x1905">xml/tagreader/tagreader.cpp</a>.
<h3 class=fn>bool <a name="parseContinue"></a>TQXmlSimpleReader::parseContinue ()<tt> [virtual]</tt>
</h3>
Continues incremental parsing; this function reads the input from
the <a href="tqxmlinputsource.html">TQXmlInputSource</a> that was specified with the last <a href="#parse">parse</a>()
command. To use this function, you <em>must</em> have called parse()
with the incremental argument set to TRUE.
<p> Returns FALSE if a parsing error occurs; otherwise returns TRUE.
<p> If the input source returns an empty string for the function
<a href="tqxmlinputsource.html#data">TQXmlInputSource::data</a>(), then this means that the end of the XML
file has been reached; this is quite important, especially if you
want to use the reader to parse more than one XML file.
<p> The case of the end of the XML file being reached without having
finished parsing is not considered to be an error: you can
continue parsing at a later stage by calling this function again
when there is more data available to parse.
<p> This function assumes that the end of the XML document is reached
if the <a href="tqxmlinputsource.html#next">TQXmlInputSource::next</a>() function returns
TQXmlInputSource::EndOfDocument. If the parser has not finished
parsing when it encounters this symbol, it is an error and FALSE
is returned.
<p> <p>See also <a href="#parse">parse</a>() and <a href="tqxmlinputsource.html#next">TQXmlInputSource::next</a>().

<h3 class=fn>void <a name="setFeature"></a>TQXmlSimpleReader::setFeature ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;name, bool&nbsp;value )<tt> [virtual]</tt>
</h3>
Sets the state of the feature <em>name</em> to <em>value</em>:
<p> If the feature is not recognized, it is ignored.
<p> The following features are supported:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Feature <th valign="top">Notes
<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://xml.org/sax/features/namespaces</em>
<td valign="top">If this feature is TRUE, namespace processing is
performed.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://xml.org/sax/features/namespace-prefixes</em>
<td valign="top">If this feature is TRUE, the the original prefixed names
and attributes used for namespace declarations are
reported.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://trolltech.com/xml/features/report-whitespace-only-CharData</em>
<td valign="top">If this feature is TRUE, CharData that only contain
whitespace are not ignored, but are reported via
<a href="tqxmlcontenthandler.html#characters">TQXmlContentHandler::characters</a>().
<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://trolltech.com/xml/features/report-start-end-entity</em>
<td valign="top">If this feature is TRUE, the parser reports
TQXmlContentHandler::startEntity() and
TQXmlContentHandler::endEntity() events. So character data
might be reported in chunks. If this feature is FALSE, the
parser does not report those events, but rather silently
substitutes the entities and reports the character data in
one chunk.
</table></center>
<p> 

<pre>    ** $Id: qt/tagreader.cpp   3.3.8   edited Jan 11 14:46 $
</pre><pre>    <a name="x2125"></a>    reader.<a href="#setFeature">setFeature</a>( "http://xml.org/sax/features/namespace-prefixes",
                           TRUE );
</pre>
<p> (Code taken from xml/tagreader-with-features/tagreader.cpp)
<p> <p>See also <a href="tqxmlreader.html#feature">feature</a>() and <a href="tqxmlreader.html#hasFeature">hasFeature</a>().

<p>Example: <a href="tqxmlsimplereader.html#x2125">xml/tagreader-with-features/tagreader.cpp</a>.
<p>Reimplemented from <a href="tqxmlreader.html#setFeature">TQXmlReader</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>