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/qxmlinputsource.html

194 lines
11 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:892 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQXmlInputSource 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>TQXmlInputSource Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
<p>The TQXmlInputSource class provides the input data for the
TQXmlReader subclasses.
<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><a href="qxmlinputsource-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQXmlInputSource"><b>TQXmlInputSource</b></a> ()</li>
<li class=fn><a href="#TQXmlInputSource-2"><b>TQXmlInputSource</b></a> ( TQIODevice&nbsp;*&nbsp;dev )</li>
<li class=fn>TQXmlInputSource ( TQFile&nbsp;&amp;&nbsp;file ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>TQXmlInputSource ( TQTextStream&nbsp;&amp;&nbsp;stream ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>virtual <a href="#~TQXmlInputSource"><b>~TQXmlInputSource</b></a> ()</li>
<li class=fn>virtual void <a href="#setData"><b>setData</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dat )</li>
<li class=fn>virtual void <a href="#setData-2"><b>setData</b></a> ( const&nbsp;TQByteArray&nbsp;&amp;&nbsp;dat )</li>
<li class=fn>virtual void <a href="#fetchData"><b>fetchData</b></a> ()</li>
<li class=fn>virtual TQString <a href="#data"><b>data</b></a> ()</li>
<li class=fn>virtual TQChar <a href="#next"><b>next</b></a> ()</li>
<li class=fn>virtual void <a href="#reset"><b>reset</b></a> ()</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual TQString <a href="#fromRawData"><b>fromRawData</b></a> ( const&nbsp;TQByteArray&nbsp;&amp;&nbsp;data, bool&nbsp;beginning = FALSE )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQXmlInputSource class provides the input data for the
<a href="qxmlreader.html">TQXmlReader</a> subclasses.
<p>
<p> All subclasses of TQXmlReader read the input XML document from this
class.
<p> This class recognizes the encoding of the data by reading the
encoding declaration in the XML file if it finds one, and reading
the data using the corresponding encoding. If it does not find an
encoding declaration, then it assumes that the data is either in
UTF-8 or UTF-16, depending on whether it can find a byte-order
mark.
<p> There are two ways to populate the input source with data: you can
construct it with a <a href="ntqiodevice.html">TQIODevice</a>* so that the input source reads the
data from that device. Or you can set the data explicitly with one
of the <a href="#setData">setData</a>() functions.
<p> Usually you either construct a TQXmlInputSource that works on a
TQIODevice* or you construct an empty TQXmlInputSource and set the
data with setData(). There are only rare occasions where you would
want to mix both methods.
<p> The TQXmlReader subclasses use the <a href="#next">next</a>() function to read the
input character by character. If you want to start from the
beginning again, use <a href="#reset">reset</a>().
<p> The functions <a href="#data">data</a>() and <a href="#fetchData">fetchData</a>() are useful if you want to do
something with the data other than parsing, e.g. displaying the
raw XML file. The benefit of using the TQXmlInputClass in such
cases is that it tries to use the correct encoding.
<p> <p>See also <a href="qxmlreader.html">TQXmlReader</a>, <a href="qxmlsimplereader.html">TQXmlSimpleReader</a>, and <a href="xml-tools.html">XML</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQXmlInputSource"></a>TQXmlInputSource::TQXmlInputSource ()
</h3>
Constructs an input source which contains no data.
<p> <p>See also <a href="#setData">setData</a>().
<h3 class=fn><a name="TQXmlInputSource-2"></a>TQXmlInputSource::TQXmlInputSource ( <a href="ntqiodevice.html">TQIODevice</a>&nbsp;*&nbsp;dev )
</h3>
Constructs an input source and gets the data from device <em>dev</em>.
If <em>dev</em> is not open, it is opened in read-only mode. If <em>dev</em>
is 0 or it is not possible to read from the device, the input
source will contain no data.
<p> <p>See also <a href="#setData">setData</a>(), <a href="#fetchData">fetchData</a>(), and <a href="ntqiodevice.html">TQIODevice</a>.
<h3 class=fn><a name="TQXmlInputSource-3"></a>TQXmlInputSource::TQXmlInputSource ( <a href="ntqfile.html">TQFile</a>&nbsp;&amp;&nbsp;file )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Constructs an input source and gets the data from the file <em>file</em>. If the
file cannot be read the input source is empty.
<h3 class=fn><a name="TQXmlInputSource-4"></a>TQXmlInputSource::TQXmlInputSource ( <a href="ntqtextstream.html">TQTextStream</a>&nbsp;&amp;&nbsp;stream )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Constructs an input source and gets the data from the text stream <em>stream</em>.
<h3 class=fn><a name="~TQXmlInputSource"></a>TQXmlInputSource::~TQXmlInputSource ()<tt> [virtual]</tt>
</h3>
Destructor.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="data"></a>TQXmlInputSource::data ()<tt> [virtual]</tt>
</h3>
Returns the data the input source contains or <a href="ntqstring.html#TQString-null">TQString::null</a> if the
input source does not contain any data.
<p> <p>See also <a href="#setData">setData</a>(), <a href="#TQXmlInputSource">TQXmlInputSource</a>(), and <a href="#fetchData">fetchData</a>().
<h3 class=fn>void <a name="fetchData"></a>TQXmlInputSource::fetchData ()<tt> [virtual]</tt>
</h3>
This function reads more data from the device that was set during
construction. If the input source already contained data, this
function deletes that data first.
<p> This object contains no data after a call to this function if the
object was constructed without a device to read data from or if
this function was not able to get more data from the device.
<p> There are two occasions where a fetch is done implicitly by
another function call: during construction (so that the object
starts out with some initial data where available), and during a
call to <a href="#next">next</a>() (if the data had run out).
<p> You don't normally need to use this function if you use next().
<p> <p>See also <a href="#data">data</a>(), <a href="#next">next</a>(), and <a href="#TQXmlInputSource">TQXmlInputSource</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="fromRawData"></a>TQXmlInputSource::fromRawData ( const&nbsp;<a href="qbytearray.html">TQByteArray</a>&nbsp;&amp;&nbsp;data, bool&nbsp;beginning = FALSE )<tt> [virtual protected]</tt>
</h3>
This function reads the XML file from <em>data</em> and tries to
recognize the encoding. It converts the raw data <em>data</em> into a
<a href="ntqstring.html">TQString</a> and returns it. It tries its best to get the correct
encoding for the XML file.
<p> If <em>beginning</em> is TRUE, this function assumes that the data
starts at the beginning of a new XML document and looks for an
encoding declaration. If <em>beginning</em> is FALSE, it converts the
raw data using the encoding determined from prior calls.
<h3 class=fn><a href="qchar.html">TQChar</a> <a name="next"></a>TQXmlInputSource::next ()<tt> [virtual]</tt>
</h3>
Returns the next character of the input source. If this function
reaches the end of available data, it returns
TQXmlInputSource::EndOfData. If you call <a href="#next">next</a>() after that, it
tries to fetch more data by calling <a href="#fetchData">fetchData</a>(). If the
fetchData() call results in new data, this function returns the
first character of that data; otherwise it returns
TQXmlInputSource::EndOfDocument.
<p> <p>See also <a href="#reset">reset</a>(), <a href="#fetchData">fetchData</a>(), <a href="qxmlsimplereader.html#parse">TQXmlSimpleReader::parse</a>(), and <a href="qxmlsimplereader.html#parseContinue">TQXmlSimpleReader::parseContinue</a>().
<h3 class=fn>void <a name="reset"></a>TQXmlInputSource::reset ()<tt> [virtual]</tt>
</h3>
This function sets the position used by <a href="#next">next</a>() to the beginning of
the data returned by <a href="#data">data</a>(). This is useful if you want to use the
input source for more than one parse.
<p> <p>See also <a href="#next">next</a>().
<p>Example: <a href="tagreader-with-features-example.html#x1975">xml/tagreader-with-features/tagreader.cpp</a>.
<h3 class=fn>void <a name="setData"></a>TQXmlInputSource::setData ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dat )<tt> [virtual]</tt>
</h3>
Sets the data of the input source to <em>dat</em>.
<p> If the input source already contains data, this function deletes
that data first.
<p> <p>See also <a href="#data">data</a>().
<h3 class=fn>void <a name="setData-2"></a>TQXmlInputSource::setData ( const&nbsp;<a href="qbytearray.html">TQByteArray</a>&nbsp;&amp;&nbsp;dat )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> The data <em>dat</em> is passed through the correct text-codec, before
it is set.
<!-- 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>