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"><!--
|
---|
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>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
|
---|
35 | simple 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 <<a href="qxml-h.html">qxml.h</a>></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 QString & name, bool value )</li>
|
---|
46 | <li class=fn>virtual bool <a href="#parse"><b>parse</b></a> ( const QXmlInputSource * input, bool 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 |
|
---|
53 | The QXmlSimpleReader class provides an implementation of a
|
---|
54 | simple 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>
|
---|
71 | Constructs 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>
|
---|
85 | Destroys the simple XML reader.
|
---|
86 |
|
---|
87 | <h3 class=fn>bool <a name="parse"></a>QXmlSimpleReader::parse ( const <a href="qxmlinputsource.html">QXmlInputSource</a> * input, bool incremental )<tt> [virtual]</tt>
|
---|
88 | </h3>
|
---|
89 | Reads an XML document from <em>input</em> and parses it. Returns FALSE
|
---|
90 | if the parsing detects an error; otherwise returns TRUE.
|
---|
91 | <p> If <em>incremental</em> is TRUE, the parser does not return FALSE when
|
---|
92 | it reaches the end of the <em>input</em> without reaching the end of the
|
---|
93 | XML file. Instead it stores the state of the parser so that
|
---|
94 | parsing can be continued at a later stage when more data is
|
---|
95 | available. You can use the function <a href="#parseContinue">parseContinue</a>() to continue
|
---|
96 | with parsing. This class stores a pointer to the input source <em>input</em> and the parseContinue() function tries to read from that
|
---|
97 | input souce. This means that you should not delete the input
|
---|
98 | source <em>input</em> until you've finished your calls to
|
---|
99 | parseContinue(). If you call this function with <em>incremental</em>
|
---|
100 | TRUE whilst an incremental parse is in progress a new parsing
|
---|
101 | session will be started and the previous session lost.
|
---|
102 | <p> If <em>incremental</em> is FALSE, this function behaves like the normal
|
---|
103 | parse function, i.e. it returns FALSE when the end of input is
|
---|
104 | reached without reaching the end of the XML file and the parsing
|
---|
105 | cannot 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>
|
---|
111 | Continues incremental parsing; this function reads the input from
|
---|
112 | the <a href="qxmlinputsource.html">QXmlInputSource</a> that was specified with the last <a href="#parse">parse</a>()
|
---|
113 | command. To use this function, you <em>must</em> have called parse()
|
---|
114 | with 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
|
---|
118 | file has been reached; this is quite important, especially if you
|
---|
119 | want 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
|
---|
121 | finished parsing is not considered to be an error: you can
|
---|
122 | continue parsing at a later stage by calling this function again
|
---|
123 | when there is more data available to parse.
|
---|
124 | <p> This function assumes that the end of the XML document is reached
|
---|
125 | if the <a href="qxmlinputsource.html#next">QXmlInputSource::next</a>() function returns
|
---|
126 | QXmlInputSource::EndOfDocument. If the parser has not finished
|
---|
127 | parsing when it encounters this symbol, it is an error and FALSE
|
---|
128 | is 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 <a href="qstring.html">QString</a> & name, bool value )<tt> [virtual]</tt>
|
---|
132 | </h3>
|
---|
133 | Sets 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
|
---|
140 | performed.
|
---|
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
|
---|
143 | and attributes used for namespace declarations are
|
---|
144 | reported.
|
---|
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
|
---|
147 | whitespace 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
|
---|
151 | QXmlContentHandler::startEntity() and
|
---|
152 | QXmlContentHandler::endEntity() events. So character data
|
---|
153 | might be reported in chunks. If this feature is FALSE, the
|
---|
154 | parser does not report those events, but rather silently
|
---|
155 | substitutes the entities and reports the character data in
|
---|
156 | one 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>
|
---|
171 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
172 | Copyright © 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 © 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>
|
---|