1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
<!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>Qt Toolkit - QXmlContentHandler Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QXmlContentHandler Class Reference<br><small>[ <a href="xml.html">XML module</a> ]</small></h1><br clear="all">
<p>
The QXmlContentHandler class provides an interface to report logical content of XML data.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qxml-h.html">qxml.h</a>></code>
<p>Inherited by <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a>.
<p><a href="qxmlcontenthandler-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn">virtualvoid<a href="#37dd28"><b>setDocumentLocator</b></a>(QXmlLocator*locator)</div>
<li><div class="fn">virtualbool<a href="#7c53e1"><b>startDocument</b></a>()</div>
<li><div class="fn">virtualbool<a href="#3e48c4"><b>endDocument</b></a>()</div>
<li><div class="fn">virtualbool<a href="#a587d5"><b>startPrefixMapping</b></a>(constQString&prefix, constQString&uri)</div>
<li><div class="fn">virtualbool<a href="#3a4e72"><b>endPrefixMapping</b></a>(constQString&prefix)</div>
<li><div class="fn">virtualbool<a href="#4cb897"><b>startElement</b></a>(constQString&namespaceURI, constQString&localName, constQString&qName, constQXmlAttributes&atts)</div>
<li><div class="fn">virtualbool<a href="#b9428c"><b>endElement</b></a>(constQString&namespaceURI, constQString&localName, constQString&qName)</div>
<li><div class="fn">virtualbool<a href="#c63930"><b>characters</b></a>(constQString&ch)</div>
<li><div class="fn">virtualbool<a href="#358016"><b>ignorableWhitespace</b></a>(constQString&ch)</div>
<li><div class="fn">virtualbool<a href="#003e9c"><b>processingInstruction</b></a>(constQString&target, constQString&data)</div>
<li><div class="fn">virtualbool<a href="#2a89c0"><b>skippedEntity</b></a>(constQString&name)</div>
<li><div class="fn">virtualQString<a href="#692f43"><b>errorString</b></a>()</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QXmlContentHandler class provides an interface to report logical content of XML data.
<p>
If the application needs to be informed of basic parsing events, it
implements this interface and sets it with <a href="qxmlreader.html#a86df9">QXmlReader::setContentHandler</a>().
The reader reports 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/or subelements) will
appear, in order, between the <a href="#4cb897">startElement</a>() event and the corresponding
<a href="#b9428c">endElement</a>() event.
<p>The class <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a> gives a default implementation for this
interface; subclassing from this class is very convenient if you want only be
informed of some parsing events.
<p>See also the <a href="xml.html#introSAX2">Introduction to SAX2</a>.
<p>See also <a href="qxmldtdhandler.html">QXmlDTDHandler</a>, <a href="qxmldeclhandler.html">QXmlDeclHandler</a>, <a href="qxmlentityresolver.html">QXmlEntityResolver</a>, <a href="qxmlerrorhandler.html">QXmlErrorHandler</a> and <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn">bool<a name="c63930"></a>QXmlContentHandler::characters(const<a href="qstring.html">QString</a>&ch) <code>[virtual]</code></h3>
<p>The reader calls this function when he has parsed a chunk of character
data (either normal character data or character data inside a CDATA section;
if you have to distinguish between those two types you have to use
<a href="qxmllexicalhandler.html#bf36d3">QXmlLexicalHandler::startCDATA</a>() and <a href="qxmllexicalhandler.html#10354f">QXmlLexicalHandler::endCDATA</a>() in
addition).
<p>Some readers will report whitespace in element content using the
<a href="#358016">ignorableWhitespace</a>() function rather than this one (<a href="qxmlsimplereader.html">QXmlSimpleReader</a> will
do it not though).
<p>A reader is allowed to 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
characters() events ("a ", "<" and " b").
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>Reimplemented in <a href="qxmldefaulthandler.html#a7262d">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="3e48c4"></a>QXmlContentHandler::endDocument() <code>[virtual]</code></h3>
<p>The reader calls this function after he has finished the parsing. It
is only called once. It is the last function of all handler functions that is
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 will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>See also <a href="#7c53e1">startDocument</a>().
<p>Reimplemented in <a href="qxmldefaulthandler.html#02a35c">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="b9428c"></a>QXmlContentHandler::endElement(const<a href="qstring.html">QString</a>&namespaceURI, const<a href="qstring.html">QString</a>&localName, const<a href="qstring.html">QString</a>&qName) <code>[virtual]</code></h3>
<p>The reader calls this function when he has parsed an end element tag.
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>See also the <a href="xml-sax.html#namespaces">namespace description</a>.
<p>See also <a href="#4cb897">startElement</a>().
<p>Reimplemented in <a href="qxmldefaulthandler.html#308cc4">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="3a4e72"></a>QXmlContentHandler::endPrefixMapping(const<a href="qstring.html">QString</a>&prefix) <code>[virtual]</code></h3>
<p>The reader calls this function to signal the end of a prefix mapping.
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>See also the <a href="xml-sax.html#namespaces">namespace description</a>.
<p>See also <a href="#a587d5">startPrefixMapping</a>().
<p>Reimplemented in <a href="qxmldefaulthandler.html#a62082">QXmlDefaultHandler</a>.
<h3 class="fn"><a href="qstring.html">QString</a><a name="692f43"></a>QXmlContentHandler::errorString() <code>[virtual]</code></h3>
<p>The reader calls this function to get an error string if any of the handler
functions returns FALSE to him.
<h3 class="fn">bool<a name="358016"></a>QXmlContentHandler::ignorableWhitespace(const<a href="qstring.html">QString</a>&ch) <code>[virtual]</code></h3>
<p>Some readers may use this function to report each chunk of whitespace in
element content (<a href="qxmlsimplereader.html">QXmlSimpleReader</a> does not though).
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>Reimplemented in <a href="qxmldefaulthandler.html#0dfc47">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="003e9c"></a>QXmlContentHandler::processingInstruction(const<a href="qstring.html">QString</a>&target, const<a href="qstring.html">QString</a>&data) <code>[virtual]</code></h3>
<p>The reader calls this function when he has parsed a processing
instruction.
<p><em>target</em> is the target name of the processing instruction and <em>data</em> is the
data of the processing instruction.
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>Reimplemented in <a href="qxmldefaulthandler.html#930a98">QXmlDefaultHandler</a>.
<h3 class="fn">void<a name="37dd28"></a>QXmlContentHandler::setDocumentLocator(<a href="qxmllocator.html">QXmlLocator</a>*locator) <code>[virtual]</code></h3>
<p>The reader calls this function before he starts parsing the document. The
argument <em>locator</em> is a pointer to a <a href="qxmllocator.html">QXmlLocator</a> which allows the
application to get the actual position of the parsing in 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 got destroyed).
<p>Reimplemented in <a href="qxmldefaulthandler.html#608141">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="2a89c0"></a>QXmlContentHandler::skippedEntity(const<a href="qstring.html">QString</a>&name) <code>[virtual]</code></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 will report it by
calling this function.
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>Reimplemented in <a href="qxmldefaulthandler.html#825459">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="7c53e1"></a>QXmlContentHandler::startDocument() <code>[virtual]</code></h3>
<p>The reader calls this function when he starts parsing the document.
The reader will call this function only once before any other functions in
this class or in the <a href="qxmldtdhandler.html">QXmlDTDHandler</a> class are called (except
<a href="#37dd28">QXmlContentHandler::setDocumentLocator</a>()).
<p>If this function returns FALSE the reader will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>See also <a href="#3e48c4">endDocument</a>().
<p>Reimplemented in <a href="qxmldefaulthandler.html#6c6604">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="4cb897"></a>QXmlContentHandler::startElement(const<a href="qstring.html">QString</a>&namespaceURI, const<a href="qstring.html">QString</a>&localName, const<a href="qstring.html">QString</a>&qName, const<a href="qxmlattributes.html">QXmlAttributes</a>&atts) <code>[virtual]</code></h3>
<p>The reader calls this function when he has parsed a start element tag.
<p>There will be a corresponding <a href="#b9428c">endElement</a>() call when the corresponding end
element tag was read. The startElement() and endElement() calls are always
nested correctly. Empty element tags (e.g. <a/>) are reported by
startElement() directly followed by a call to endElement().
<p>The attribute list provided will contain only attributes with explicit
values. The attribute list will contain 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>uri</em> is the namespace URI, or the empty string if the element
has no namespace URI or if namespace processing is not being performed, <em>localName</em> is the local name (without prefix), or the empty string if
namespace processing is not being performed, <em>qName</em> is the qualified name
(with prefix), or the empty string if qualified names are not available 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 will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>See also the <a href="xml-sax.html#namespaces">namespace description</a>.
<p>See also <a href="#b9428c">endElement</a>().
<p>Reimplemented in <a href="qxmldefaulthandler.html#f71fa3">QXmlDefaultHandler</a>.
<h3 class="fn">bool<a name="a587d5"></a>QXmlContentHandler::startPrefixMapping(const<a href="qstring.html">QString</a>&prefix, const<a href="qstring.html">QString</a>&uri) <code>[virtual]</code></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 startPrefixMapping and endPrefixMapping calls are not guaranteed to
be properly nested relative to each-other: all startPrefixMapping events will
occur before the corresponding startElement event, and all endPrefixMapping
events will occur after the corresponding endElement 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 will stop parsing and will report
an error. The reader will use the function <a href="#692f43">errorString</a>() to get the error
message that will be used for reporting the error.
<p>See also the <a href="xml-sax.html#namespaces">namespace description</a>.
<p>See also <a href="#3a4e72">endPrefixMapping</a>().
<p>Reimplemented in <a href="qxmldefaulthandler.html#f35e3d">QXmlDefaultHandler</a>.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|