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.
266 lines
16 KiB
266 lines
16 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<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 Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped 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 <<a href="tqxml-h.html">tqxml.h</a>></tt>
|
|
<p>Inherited by <a href="tqxmldefaulthandler.html">TQXmlDefaultHandler</a>.
|
|
<p><a href="tqxmlcontenthandler-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 * 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 TQString & prefix, const TQString & uri ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#endPrefixMapping"><b>endPrefixMapping</b></a> ( const TQString & prefix ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#startElement"><b>startElement</b></a> ( const TQString & namespaceURI, const TQString & localName, const TQString & qName, const TQXmlAttributes & atts ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#endElement"><b>endElement</b></a> ( const TQString & namespaceURI, const TQString & localName, const TQString & qName ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#characters"><b>characters</b></a> ( const TQString & ch ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#ignorableWhitespace"><b>ignorableWhitespace</b></a> ( const TQString & ch ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#processingInstruction"><b>processingInstruction</b></a> ( const TQString & target, const TQString & data ) = 0</li>
|
|
<li class=fn>virtual bool <a href="#skippedEntity"><b>skippedEntity</b></a> ( const TQString & 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="tqxmlreader.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="tqxmldefaulthandler.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="tqxmldtdhandler.html">TQXmlDTDHandler</a>, <a href="tqxmldeclhandler.html">TQXmlDeclHandler</a>, <a href="tqxmlentityresolver.html">TQXmlEntityResolver</a>, <a href="tqxmlerrorhandler.html">TQXmlErrorHandler</a>, <a href="tqxmllexicalhandler.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 <a href="tqstring.html">TQString</a> & 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="tqxmllexicalhandler.html#startCDATA">TQXmlLexicalHandler::startCDATA</a>() and
|
|
<a href="tqxmllexicalhandler.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<b" in three
|
|
<a href="#characters">characters</a>() events ("a ", "<" 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 <a href="tqstring.html">TQString</a> & namespaceURI, const <a href="tqstring.html">TQString</a> & localName, const <a href="tqstring.html">TQString</a> & 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 <a href="tqstring.html">TQString</a> & 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="tqstring.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 <a href="tqstring.html">TQString</a> & 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 <a href="tqstring.html">TQString</a> & target, const <a href="tqstring.html">TQString</a> & 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="tqxmllocator.html">TQXmlLocator</a> * 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="tqxmllocator.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 <a href="tqstring.html">TQString</a> & 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="tqxmldtdhandler.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 <a href="tqstring.html">TQString</a> & namespaceURI, const <a href="tqstring.html">TQString</a> & localName, const <a href="tqstring.html">TQString</a> & qName, const <a href="tqxmlattributes.html">TQXmlAttributes</a> & 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><x/></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="tqstring.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 <a href="tqstring.html">TQString</a> & prefix, const <a href="tqstring.html">TQString</a> & 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 © 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 © 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>
|