You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/qxmlsimplereader.html

180 lines
9.5 KiB

<!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: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="qxml-h.html">ntqxml.h</a>&gt;</tt>
<p>Inherits <a href="qxmlreader.html">TQXmlReader</a>.
<p><a href="qxmlsimplereader-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="qxmlinputsource.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="qxmlinputsource.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="qxmlinputsource.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="qxmlinputsource.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="qxmlinputsource.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="qxmlcontenthandler.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="qxmlreader.html#feature">feature</a>() and <a href="qxmlreader.html#hasFeature">hasFeature</a>().
<p>Example: <a href="qxmlsimplereader.html#x2125">xml/tagreader-with-features/tagreader.cpp</a>.
<p>Reimplemented from <a href="qxmlreader.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>