source: trunk/doc/html/qxmlsimplereader.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 9.7 KB
Line 
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:2568 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QXmlSimpleReader Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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>QXmlSimpleReader Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
33
34<p>The QXmlSimpleReader class provides an implementation of a
35simple XML reader (parser).
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 &lt;<a href="qxml-h.html">qxml.h</a>&gt;</tt>
39<p>Inherits <a href="qxmlreader.html">QXmlReader</a>.
40<p><a href="qxmlsimplereader-members.html">List of all member functions.</a>
41<h2>Public Members</h2>
42<ul>
43<li class=fn><a href="#QXmlSimpleReader"><b>QXmlSimpleReader</b></a> ()</li>
44<li class=fn>virtual <a href="#~QXmlSimpleReader"><b>~QXmlSimpleReader</b></a> ()</li>
45<li class=fn>virtual void <a href="#setFeature"><b>setFeature</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name, bool&nbsp;value )</li>
46<li class=fn>virtual bool <a href="#parse"><b>parse</b></a> ( const&nbsp;QXmlInputSource&nbsp;*&nbsp;input, bool&nbsp;incremental )</li>
47<li class=fn>virtual bool <a href="#parseContinue"><b>parseContinue</b></a> ()</li>
48</ul>
49<hr><a name="details"></a><h2>Detailed Description</h2>
50
51
52
53The QXmlSimpleReader class provides an implementation of a
54simple XML reader (parser).
55
56<p>
57
58
59<p> This XML reader is sufficient for simple parsing tasks. The reader:
60<ul>
61<li> provides a well-formed parser;
62<li> does not parse any external entities;
63<li> can do namespace processing.
64</ul>
65<p> Documents are parsed with a call to <a href="#parse">parse</a>().
66<p> <p>See also <a href="xml-tools.html">XML</a>.
67
68<hr><h2>Member Function Documentation</h2>
69<h3 class=fn><a name="QXmlSimpleReader"></a>QXmlSimpleReader::QXmlSimpleReader ()
70</h3>
71Constructs a simple XML reader with the following feature settings:
72<center><table cellpadding="4" cellspacing="2" border="0">
73<tr bgcolor="#a2c511"> <th valign="top">Feature <th valign="top">Setting
74<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://xml.org/sax/features/namespaces</em> <td valign="top">TRUE
75<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://xml.org/sax/features/namespace-prefixes</em> <td valign="top">FALSE
76<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://trolltech.com/xml/features/report-whitespace-only-CharData</em>
77<td valign="top">TRUE
78<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://trolltech.com/xml/features/report-start-end-entity</em> <td valign="top">FALSE
79</table></center>
80<p> More information about features can be found in the <a href="xml.html#sax2Features">Qt SAX2 overview.</a>
81<p> <p>See also <a href="#setFeature">setFeature</a>().
82
83<h3 class=fn><a name="~QXmlSimpleReader"></a>QXmlSimpleReader::~QXmlSimpleReader ()<tt> [virtual]</tt>
84</h3>
85Destroys the simple XML reader.
86
87<h3 class=fn>bool <a name="parse"></a>QXmlSimpleReader::parse ( const&nbsp;<a href="qxmlinputsource.html">QXmlInputSource</a>&nbsp;*&nbsp;input, bool&nbsp;incremental )<tt> [virtual]</tt>
88</h3>
89Reads an XML document from <em>input</em> and parses it. Returns FALSE
90if the parsing detects an error; otherwise returns TRUE.
91<p> If <em>incremental</em> is TRUE, the parser does not return FALSE when
92it reaches the end of the <em>input</em> without reaching the end of the
93XML file. Instead it stores the state of the parser so that
94parsing can be continued at a later stage when more data is
95available. You can use the function <a href="#parseContinue">parseContinue</a>() to continue
96with parsing. This class stores a pointer to the input source <em>input</em> and the parseContinue() function tries to read from that
97input souce. This means that you should not delete the input
98source <em>input</em> until you've finished your calls to
99parseContinue(). If you call this function with <em>incremental</em>
100TRUE whilst an incremental parse is in progress a new parsing
101session will be started and the previous session lost.
102<p> If <em>incremental</em> is FALSE, this function behaves like the normal
103parse function, i.e. it returns FALSE when the end of input is
104reached without reaching the end of the XML file and the parsing
105cannot be continued.
106<p> <p>See also <a href="#parseContinue">parseContinue</a>() and <a href="qsocket.html">QSocket</a>.
107
108<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>.
109<h3 class=fn>bool <a name="parseContinue"></a>QXmlSimpleReader::parseContinue ()<tt> [virtual]</tt>
110</h3>
111Continues incremental parsing; this function reads the input from
112the <a href="qxmlinputsource.html">QXmlInputSource</a> that was specified with the last <a href="#parse">parse</a>()
113command. To use this function, you <em>must</em> have called parse()
114with the incremental argument set to TRUE.
115<p> Returns FALSE if a parsing error occurs; otherwise returns TRUE.
116<p> If the input source returns an empty string for the function
117<a href="qxmlinputsource.html#data">QXmlInputSource::data</a>(), then this means that the end of the XML
118file has been reached; this is quite important, especially if you
119want to use the reader to parse more than one XML file.
120<p> The case of the end of the XML file being reached without having
121finished parsing is not considered to be an error: you can
122continue parsing at a later stage by calling this function again
123when there is more data available to parse.
124<p> This function assumes that the end of the XML document is reached
125if the <a href="qxmlinputsource.html#next">QXmlInputSource::next</a>() function returns
126QXmlInputSource::EndOfDocument. If the parser has not finished
127parsing when it encounters this symbol, it is an error and FALSE
128is returned.
129<p> <p>See also <a href="#parse">parse</a>() and <a href="qxmlinputsource.html#next">QXmlInputSource::next</a>().
130
131<h3 class=fn>void <a name="setFeature"></a>QXmlSimpleReader::setFeature ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name, bool&nbsp;value )<tt> [virtual]</tt>
132</h3>
133Sets the state of the feature <em>name</em> to <em>value</em>:
134<p> If the feature is not recognized, it is ignored.
135<p> The following features are supported:
136<center><table cellpadding="4" cellspacing="2" border="0">
137<tr bgcolor="#a2c511"> <th valign="top">Feature <th valign="top">Notes
138<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://xml.org/sax/features/namespaces</em>
139<td valign="top">If this feature is TRUE, namespace processing is
140performed.
141<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://xml.org/sax/features/namespace-prefixes</em>
142<td valign="top">If this feature is TRUE, the the original prefixed names
143and attributes used for namespace declarations are
144reported.
145<tr bgcolor="#f0f0f0"> <td valign="top"><em>http://trolltech.com/xml/features/report-whitespace-only-CharData</em>
146<td valign="top">If this feature is TRUE, CharData that only contain
147whitespace are not ignored, but are reported via
148<a href="qxmlcontenthandler.html#characters">QXmlContentHandler::characters</a>().
149<tr bgcolor="#d0d0d0"> <td valign="top"><em>http://trolltech.com/xml/features/report-start-end-entity</em>
150<td valign="top">If this feature is TRUE, the parser reports
151QXmlContentHandler::startEntity() and
152QXmlContentHandler::endEntity() events. So character data
153might be reported in chunks. If this feature is FALSE, the
154parser does not report those events, but rather silently
155substitutes the entities and reports the character data in
156one chunk.
157</table></center>
158<p>
159
160<pre> ** $Id: qxmlsimplereader.html 2051 2007-02-21 10:04:20Z chehrlic $
161</pre><pre> <a name="x2125"></a> reader.<a href="#setFeature">setFeature</a>( "http://xml.org/sax/features/namespace-prefixes",
162 TRUE );
163</pre>
164<p> (Code taken from xml/tagreader-with-features/tagreader.cpp)
165<p> <p>See also <a href="qxmlreader.html#feature">feature</a>() and <a href="qxmlreader.html#hasFeature">hasFeature</a>().
166
167<p>Example: <a href="qxmlsimplereader.html#x2125">xml/tagreader-with-features/tagreader.cpp</a>.
168<p>Reimplemented from <a href="qxmlreader.html#setFeature">QXmlReader</a>.
169<!-- eof -->
170<hr><p>
171This file is part of the <a href="index.html">Qt toolkit</a>.
172Copyright &copy; 1995-2007
173<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
174<table width=100% cellspacing=0 border=0><tr>
175<td>Copyright &copy; 2007
176<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
177<td align=right><div align=right>Qt 3.3.8</div>
178</table></div></address></body>
179</html>
Note: See TracBrowser for help on using the repository browser.