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

267 lines
16 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:1207 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQXmlContentHandler 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>TQXmlContentHandler Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
<p>The TQXmlContentHandler class provides an interface to
report the logical content of XML data.
<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>Inherited by <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a>.
<p><a href="qxmlcontenthandler-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>virtual void <a href="#setDocumentLocator"><b>setDocumentLocator</b></a> ( TQXmlLocator&nbsp;*&nbsp;locator ) = 0</li>
<li class=fn>virtual bool <a href="#startDocument"><b>startDocument</b></a> () = 0</li>
<li class=fn>virtual bool <a href="#endDocument"><b>endDocument</b></a> () = 0</li>
<li class=fn>virtual bool <a href="#startPrefixMapping"><b>startPrefixMapping</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;prefix, const&nbsp;TQString&nbsp;&amp;&nbsp;uri ) = 0</li>
<li class=fn>virtual bool <a href="#endPrefixMapping"><b>endPrefixMapping</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;prefix ) = 0</li>
<li class=fn>virtual bool <a href="#startElement"><b>startElement</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;TQString&nbsp;&amp;&nbsp;localName, const&nbsp;TQString&nbsp;&amp;&nbsp;qName, const&nbsp;TQXmlAttributes&nbsp;&amp;&nbsp;atts ) = 0</li>
<li class=fn>virtual bool <a href="#endElement"><b>endElement</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;TQString&nbsp;&amp;&nbsp;localName, const&nbsp;TQString&nbsp;&amp;&nbsp;qName ) = 0</li>
<li class=fn>virtual bool <a href="#characters"><b>characters</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;ch ) = 0</li>
<li class=fn>virtual bool <a href="#ignorableWhitespace"><b>ignorableWhitespace</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;ch ) = 0</li>
<li class=fn>virtual bool <a href="#processingInstruction"><b>processingInstruction</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;target, const&nbsp;TQString&nbsp;&amp;&nbsp;data ) = 0</li>
<li class=fn>virtual bool <a href="#skippedEntity"><b>skippedEntity</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name ) = 0</li>
<li class=fn>virtual TQString <a href="#errorString"><b>errorString</b></a> () = 0</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQXmlContentHandler class provides an interface to
report the logical content of XML data.
<p>
<p> If the application needs to be informed of basic parsing events,
it can implement this interface and activate it using
<a href="qxmlreader.html#setContentHandler">TQXmlReader::setContentHandler</a>(). The reader can then report basic
document-related events like the start and end of elements and
character data through this interface.
<p> The order of events in this interface is very important, and
mirrors the order of information in the document itself. For
example, all of an element's content (character data, processing
instructions, and sub-elements) appears, in order, between the
<a href="#startElement">startElement</a>() event and the corresponding <a href="#endElement">endElement</a>() event.
<p> The class <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a> provides a default implementation for
this interface; subclassing from the TQXmlDefaultHandler class is
very convenient if you only want to be informed of some parsing
events.
<p> The <a href="#startDocument">startDocument</a>() function is called at the start of the
document, and <a href="#endDocument">endDocument</a>() is called at the end. Before parsing
begins <a href="#setDocumentLocator">setDocumentLocator</a>() is called. For each element
startElement() is called, with endElement() being called at the
end of each element. The <a href="#characters">characters</a>() function is called with
chunks of character data; <a href="#ignorableWhitespace">ignorableWhitespace</a>() is called with
chunks of whitespace and <a href="#processingInstruction">processingInstruction</a>() is called with
processing instructions. If an entity is skipped <a href="#skippedEntity">skippedEntity</a>()
is called. At the beginning of prefix-URI scopes
<a href="#startPrefixMapping">startPrefixMapping</a>() is called.
<p> See also the <a href="xml.html#sax2Intro">Introduction to SAX2</a>.
<p> <p>See also <a href="qxmldtdhandler.html">TQXmlDTDHandler</a>, <a href="qxmldeclhandler.html">TQXmlDeclHandler</a>, <a href="qxmlentityresolver.html">TQXmlEntityResolver</a>, <a href="qxmlerrorhandler.html">TQXmlErrorHandler</a>, <a href="qxmllexicalhandler.html">TQXmlLexicalHandler</a>, and <a href="xml-tools.html">XML</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn>bool <a name="characters"></a>TQXmlContentHandler::characters ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;ch )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function when it has parsed a chunk of
character data (either normal character data or character data
inside a CDATA section; if you need to distinguish between those
two types you must use <a href="qxmllexicalhandler.html#startCDATA">TQXmlLexicalHandler::startCDATA</a>() and
<a href="qxmllexicalhandler.html#endCDATA">TQXmlLexicalHandler::endCDATA</a>()). The character data is reported in
<em>ch</em>.
<p> Some readers report whitespace in element content using the
<a href="#ignorableWhitespace">ignorableWhitespace</a>() function rather than using this one.
<p> A reader may report the character data of an element in more than
one chunk; e.g. a reader might want to report "a&lt;b" in three
<a href="#characters">characters</a>() events ("a ", "&lt;" and " b").
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<h3 class=fn>bool <a name="endDocument"></a>TQXmlContentHandler::endDocument ()<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function after it has finished parsing. It
is called just once, and is the last handler function called. It
is called after the reader has read all input or has abandoned
parsing because of a fatal error.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> <p>See also <a href="#startDocument">startDocument</a>().
<h3 class=fn>bool <a name="endElement"></a>TQXmlContentHandler::endElement ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;localName, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;qName )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function when it has parsed an end element
tag with the qualified name <em>qName</em>, the local name <em>localName</em>
and the namespace URI <em>namespaceURI</em>.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#startElement">startElement</a>().
<p>Example: <a href="xml-sax-walkthrough.html#x2136">xml/tagreader/structureparser.cpp</a>.
<h3 class=fn>bool <a name="endPrefixMapping"></a>TQXmlContentHandler::endPrefixMapping ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;prefix )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function to signal the end of a prefix
mapping for the prefix <em>prefix</em>.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#startPrefixMapping">startPrefixMapping</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="errorString"></a>TQXmlContentHandler::errorString ()<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function to get an error string, e.g. if any
of the handler functions returns FALSE.
<h3 class=fn>bool <a name="ignorableWhitespace"></a>TQXmlContentHandler::ignorableWhitespace ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;ch )<tt> [pure virtual]</tt>
</h3>
<p> Some readers may use this function to report each chunk of
whitespace in element content. The whitespace is reported in <em>ch</em>.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<h3 class=fn>bool <a name="processingInstruction"></a>TQXmlContentHandler::processingInstruction ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;target, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;data )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function when it has parsed a processing
instruction.
<p> <em>target</em> is the target name of the processing instruction and <em>data</em> is the data in the processing instruction.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<h3 class=fn>void <a name="setDocumentLocator"></a>TQXmlContentHandler::setDocumentLocator ( <a href="qxmllocator.html">TQXmlLocator</a>&nbsp;*&nbsp;locator )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function before it starts parsing the
document. The argument <em>locator</em> is a pointer to a <a href="qxmllocator.html">TQXmlLocator</a>
which allows the application to get the parsing position within
the document.
<p> Do not destroy the <em>locator</em>; it is destroyed when the reader is
destroyed. (Do not use the <em>locator</em> after the reader is
destroyed).
<h3 class=fn>bool <a name="skippedEntity"></a>TQXmlContentHandler::skippedEntity ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;name )<tt> [pure virtual]</tt>
</h3>
<p> Some readers may skip entities if they have not seen the
declarations (e.g. because they are in an external DTD). If they
do so they report that they skipped the entity called <em>name</em> by
calling this function.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<h3 class=fn>bool <a name="startDocument"></a>TQXmlContentHandler::startDocument ()<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function when it starts parsing the
document. The reader calls this function just once, after the call
to <a href="#setDocumentLocator">setDocumentLocator</a>(), and before any other functions in this
class or in the <a href="qxmldtdhandler.html">TQXmlDTDHandler</a> class are called.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> <p>See also <a href="#endDocument">endDocument</a>().
<p>Example: <a href="xml-sax-walkthrough.html#x2137">xml/tagreader/structureparser.cpp</a>.
<h3 class=fn>bool <a name="startElement"></a>TQXmlContentHandler::startElement ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;namespaceURI, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;localName, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;qName, const&nbsp;<a href="qxmlattributes.html">TQXmlAttributes</a>&nbsp;&amp;&nbsp;atts )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function when it has parsed a start element
tag.
<p> There is a corresponding <a href="#endElement">endElement</a>() call when the corresponding
end element tag is read. The <a href="#startElement">startElement</a>() and endElement() calls
are always nested correctly. Empty element tags (e.g. <tt>&lt;x/&gt;</tt>)
cause a startElement() call to be immediately followed by an
endElement() call.
<p> The attribute list provided only contains attributes with explicit
values. The attribute list contains attributes used for namespace
declaration (i.e. attributes starting with xmlns) only if the
namespace-prefix property of the reader is TRUE.
<p> The argument <em>namespaceURI</em> is the namespace URI, or
<a href="ntqstring.html#TQString-null">TQString::null</a> if the element has no namespace URI or if no
namespace processing is done. <em>localName</em> is the local name
(without prefix), or TQString::null if no namespace processing is
done, <em>qName</em> is the qualified name (with prefix) and <em>atts</em> are
the attributes attached to the element. If there are no
attributes, <em>atts</em> is an empty attributes object.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#endElement">endElement</a>().
<p>Example: <a href="xml-sax-walkthrough.html#x2138">xml/tagreader/structureparser.cpp</a>.
<h3 class=fn>bool <a name="startPrefixMapping"></a>TQXmlContentHandler::startPrefixMapping ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;prefix, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;uri )<tt> [pure virtual]</tt>
</h3>
<p> The reader calls this function to signal the begin of a prefix-URI
namespace mapping scope. This information is not necessary for
normal namespace processing since the reader automatically
replaces prefixes for element and attribute names.
<p> Note that <a href="#startPrefixMapping">startPrefixMapping</a>() and <a href="#endPrefixMapping">endPrefixMapping</a>() calls are
not guaranteed to be properly nested relative to each other: all
startPrefixMapping() events occur before the corresponding
<a href="#startElement">startElement</a>() event, and all endPrefixMapping() events occur
after the corresponding <a href="#endElement">endElement</a>() event, but their order is not
otherwise guaranteed.
<p> The argument <em>prefix</em> is the namespace prefix being declared and
the argument <em>uri</em> is the namespace URI the prefix is mapped to.
<p> If this function returns FALSE the reader stops parsing and
reports an error. The reader uses the function <a href="#errorString">errorString</a>() to
get the error message.
<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
<p> <p>See also <a href="#endPrefixMapping">endPrefixMapping</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>