[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/xml/qxml.cpp:2348 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QXmlReader Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QXmlReader Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QXmlReader class provides an interface for XML readers (i.e.
|
---|
| 35 | parsers).
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
|
---|
| 38 | <p><tt>#include <<a href="qxml-h.html">qxml.h</a>></tt>
|
---|
| 39 | <p>Inherited by <a href="qxmlsimplereader.html">QXmlSimpleReader</a>.
|
---|
| 40 | <p><a href="qxmlreader-members.html">List of all member functions.</a>
|
---|
| 41 | <h2>Public Members</h2>
|
---|
| 42 | <ul>
|
---|
| 43 | <li class=fn>virtual bool <a href="#feature"><b>feature</b></a> ( const QString & name, bool * ok = 0 ) const = 0</li>
|
---|
| 44 | <li class=fn>virtual void <a href="#setFeature"><b>setFeature</b></a> ( const QString & name, bool value ) = 0</li>
|
---|
| 45 | <li class=fn>virtual bool <a href="#hasFeature"><b>hasFeature</b></a> ( const QString & name ) const = 0</li>
|
---|
| 46 | <li class=fn>virtual void * <a href="#property"><b>property</b></a> ( const QString & name, bool * ok = 0 ) const = 0</li>
|
---|
| 47 | <li class=fn>virtual void <a href="#setProperty"><b>setProperty</b></a> ( const QString & name, void * value ) = 0</li>
|
---|
| 48 | <li class=fn>virtual bool <a href="#hasProperty"><b>hasProperty</b></a> ( const QString & name ) const = 0</li>
|
---|
| 49 | <li class=fn>virtual void <a href="#setEntityResolver"><b>setEntityResolver</b></a> ( QXmlEntityResolver * handler ) = 0</li>
|
---|
| 50 | <li class=fn>virtual QXmlEntityResolver * <a href="#entityResolver"><b>entityResolver</b></a> () const = 0</li>
|
---|
| 51 | <li class=fn>virtual void <a href="#setDTDHandler"><b>setDTDHandler</b></a> ( QXmlDTDHandler * handler ) = 0</li>
|
---|
| 52 | <li class=fn>virtual QXmlDTDHandler * <a href="#DTDHandler"><b>DTDHandler</b></a> () const = 0</li>
|
---|
| 53 | <li class=fn>virtual void <a href="#setContentHandler"><b>setContentHandler</b></a> ( QXmlContentHandler * handler ) = 0</li>
|
---|
| 54 | <li class=fn>virtual QXmlContentHandler * <a href="#contentHandler"><b>contentHandler</b></a> () const = 0</li>
|
---|
| 55 | <li class=fn>virtual void <a href="#setErrorHandler"><b>setErrorHandler</b></a> ( QXmlErrorHandler * handler ) = 0</li>
|
---|
| 56 | <li class=fn>virtual QXmlErrorHandler * <a href="#errorHandler"><b>errorHandler</b></a> () const = 0</li>
|
---|
| 57 | <li class=fn>virtual void <a href="#setLexicalHandler"><b>setLexicalHandler</b></a> ( QXmlLexicalHandler * handler ) = 0</li>
|
---|
| 58 | <li class=fn>virtual QXmlLexicalHandler * <a href="#lexicalHandler"><b>lexicalHandler</b></a> () const = 0</li>
|
---|
| 59 | <li class=fn>virtual void <a href="#setDeclHandler"><b>setDeclHandler</b></a> ( QXmlDeclHandler * handler ) = 0</li>
|
---|
| 60 | <li class=fn>virtual QXmlDeclHandler * <a href="#declHandler"><b>declHandler</b></a> () const = 0</li>
|
---|
| 61 | <li class=fn>virtual bool parse ( const QXmlInputSource & input ) = 0 <em>(obsolete)</em></li>
|
---|
| 62 | <li class=fn>virtual bool <a href="#parse"><b>parse</b></a> ( const QXmlInputSource * input ) = 0</li>
|
---|
| 63 | </ul>
|
---|
| 64 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | The QXmlReader class provides an interface for XML readers (i.e.
|
---|
| 69 | parsers).
|
---|
| 70 |
|
---|
| 71 | <p>
|
---|
| 72 |
|
---|
| 73 | <p> This abstract class provides an interface for all of Qt's XML
|
---|
| 74 | readers. Currently there is only one implementation of a reader
|
---|
| 75 | included in Qt's XML module: <a href="qxmlsimplereader.html">QXmlSimpleReader</a>. In future releases
|
---|
| 76 | there might be more readers with different properties available
|
---|
| 77 | (e.g. a validating parser).
|
---|
| 78 | <p> The design of the XML classes follows the <a href="http://www.saxproject.org/">SAX2 Java interface</a>, with
|
---|
| 79 | the names adapted to fit Qt naming conventions. It should be very
|
---|
| 80 | easy for anybody who has worked with SAX2 to get started with the
|
---|
| 81 | Qt XML classes.
|
---|
| 82 | <p> All readers use the class <a href="qxmlinputsource.html">QXmlInputSource</a> to read the input
|
---|
| 83 | document. Since you are normally interested in particular content
|
---|
| 84 | in the XML document, the reader reports the content through
|
---|
| 85 | special handler classes (<a href="qxmldtdhandler.html">QXmlDTDHandler</a>, <a href="qxmldeclhandler.html">QXmlDeclHandler</a>,
|
---|
| 86 | <a href="qxmlcontenthandler.html">QXmlContentHandler</a>, <a href="qxmlentityresolver.html">QXmlEntityResolver</a>, <a href="qxmlerrorhandler.html">QXmlErrorHandler</a> and
|
---|
| 87 | <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a>), which you must subclass, if you want to
|
---|
| 88 | process the contents.
|
---|
| 89 | <p> Since the handler classes only describe interfaces you must
|
---|
| 90 | implement all the functions. We provide the <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a>
|
---|
| 91 | class to make this easier: it implements a default behaviour (do
|
---|
| 92 | nothing) for all functions, so you can subclass it and just
|
---|
| 93 | implement the functions you are interested in.
|
---|
| 94 | <p> Features and properties of the reader can be set with <a href="#setFeature">setFeature</a>()
|
---|
| 95 | and <a href="#setProperty">setProperty</a>() respectively. You can set the reader to use your
|
---|
| 96 | own subclasses with <a href="#setEntityResolver">setEntityResolver</a>(), <a href="#setDTDHandler">setDTDHandler</a>(),
|
---|
| 97 | <a href="#setContentHandler">setContentHandler</a>(), <a href="#setErrorHandler">setErrorHandler</a>(), <a href="#setLexicalHandler">setLexicalHandler</a>() and
|
---|
| 98 | <a href="#setDeclHandler">setDeclHandler</a>(). The parse itself is started with a call to
|
---|
| 99 | <a href="#parse">parse</a>().
|
---|
| 100 | <p> <p>See also <a href="qxmlsimplereader.html">QXmlSimpleReader</a> and <a href="xml-tools.html">XML</a>.
|
---|
| 101 |
|
---|
| 102 | <hr><h2>Member Function Documentation</h2>
|
---|
| 103 | <h3 class=fn><a href="qxmldtdhandler.html">QXmlDTDHandler</a> * <a name="DTDHandler"></a>QXmlReader::DTDHandler () const<tt> [pure virtual]</tt>
|
---|
| 104 | </h3>
|
---|
| 105 |
|
---|
| 106 | <p> Returns the DTD handler or 0 if none was set.
|
---|
| 107 | <p> <p>See also <a href="#setDTDHandler">setDTDHandler</a>().
|
---|
| 108 |
|
---|
| 109 | <h3 class=fn><a href="qxmlcontenthandler.html">QXmlContentHandler</a> * <a name="contentHandler"></a>QXmlReader::contentHandler () const<tt> [pure virtual]</tt>
|
---|
| 110 | </h3>
|
---|
| 111 |
|
---|
| 112 | <p> Returns the content handler or 0 if none was set.
|
---|
| 113 | <p> <p>See also <a href="#setContentHandler">setContentHandler</a>().
|
---|
| 114 |
|
---|
| 115 | <h3 class=fn><a href="qxmldeclhandler.html">QXmlDeclHandler</a> * <a name="declHandler"></a>QXmlReader::declHandler () const<tt> [pure virtual]</tt>
|
---|
| 116 | </h3>
|
---|
| 117 |
|
---|
| 118 | <p> Returns the declaration handler or 0 if none was set.
|
---|
| 119 | <p> <p>See also <a href="#setDeclHandler">setDeclHandler</a>().
|
---|
| 120 |
|
---|
| 121 | <h3 class=fn><a href="qxmlentityresolver.html">QXmlEntityResolver</a> * <a name="entityResolver"></a>QXmlReader::entityResolver () const<tt> [pure virtual]</tt>
|
---|
| 122 | </h3>
|
---|
| 123 |
|
---|
| 124 | <p> Returns the entity resolver or 0 if none was set.
|
---|
| 125 | <p> <p>See also <a href="#setEntityResolver">setEntityResolver</a>().
|
---|
| 126 |
|
---|
| 127 | <h3 class=fn><a href="qxmlerrorhandler.html">QXmlErrorHandler</a> * <a name="errorHandler"></a>QXmlReader::errorHandler () const<tt> [pure virtual]</tt>
|
---|
| 128 | </h3>
|
---|
| 129 |
|
---|
| 130 | <p> Returns the error handler or 0 if none is set.
|
---|
| 131 | <p> <p>See also <a href="#setErrorHandler">setErrorHandler</a>().
|
---|
| 132 |
|
---|
| 133 | <h3 class=fn>bool <a name="feature"></a>QXmlReader::feature ( const <a href="qstring.html">QString</a> & name, bool * ok = 0 ) const<tt> [pure virtual]</tt>
|
---|
| 134 | </h3>
|
---|
| 135 |
|
---|
| 136 | <p> If the reader has the feature called <em>name</em>, the feature's value
|
---|
| 137 | is returned. If no such feature exists the return value is
|
---|
| 138 | undefined.
|
---|
| 139 | <p> If <em>ok</em> is not 0: <em>*ok</em> is set to TRUE if the reader has the
|
---|
| 140 | feature called <em>name</em>; otherwise <em>*ok</em> is set to FALSE.
|
---|
| 141 | <p> <p>See also <a href="#setFeature">setFeature</a>() and <a href="#hasFeature">hasFeature</a>().
|
---|
| 142 |
|
---|
| 143 | <h3 class=fn>bool <a name="hasFeature"></a>QXmlReader::hasFeature ( const <a href="qstring.html">QString</a> & name ) const<tt> [pure virtual]</tt>
|
---|
| 144 | </h3>
|
---|
| 145 |
|
---|
| 146 | <p> Returns <tt>TRUE</tt> if the reader has the feature called <em>name</em>;
|
---|
| 147 | otherwise returns FALSE.
|
---|
| 148 | <p> <p>See also <a href="#feature">feature</a>() and <a href="#setFeature">setFeature</a>().
|
---|
| 149 |
|
---|
| 150 | <h3 class=fn>bool <a name="hasProperty"></a>QXmlReader::hasProperty ( const <a href="qstring.html">QString</a> & name ) const<tt> [pure virtual]</tt>
|
---|
| 151 | </h3>
|
---|
| 152 |
|
---|
| 153 | <p> Returns TRUE if the reader has the property <em>name</em>; otherwise
|
---|
| 154 | returns FALSE.
|
---|
| 155 | <p> <p>See also <a href="#property">property</a>() and <a href="#setProperty">setProperty</a>().
|
---|
| 156 |
|
---|
| 157 | <h3 class=fn><a href="qxmllexicalhandler.html">QXmlLexicalHandler</a> * <a name="lexicalHandler"></a>QXmlReader::lexicalHandler () const<tt> [pure virtual]</tt>
|
---|
| 158 | </h3>
|
---|
| 159 |
|
---|
| 160 | <p> Returns the lexical handler or 0 if none was set.
|
---|
| 161 | <p> <p>See also <a href="#setLexicalHandler">setLexicalHandler</a>().
|
---|
| 162 |
|
---|
| 163 | <h3 class=fn>bool <a name="parse"></a>QXmlReader::parse ( const <a href="qxmlinputsource.html">QXmlInputSource</a> * input )<tt> [pure virtual]</tt>
|
---|
| 164 | </h3>
|
---|
| 165 |
|
---|
| 166 | <p> Reads an XML document from <em>input</em> and parses it. Returns TRUE if
|
---|
| 167 | the parsing was successful; otherwise returns FALSE.
|
---|
| 168 |
|
---|
| 169 | <p>Example: <a href="xml-sax-walkthrough.html#x2139">xml/tagreader/tagreader.cpp</a>.
|
---|
| 170 | <h3 class=fn>bool <a name="parse-2"></a>QXmlReader::parse ( const <a href="qxmlinputsource.html">QXmlInputSource</a> & input )<tt> [pure virtual]</tt>
|
---|
| 171 | </h3>
|
---|
| 172 |
|
---|
| 173 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
| 174 | <p>
|
---|
| 175 | <h3 class=fn>void * <a name="property"></a>QXmlReader::property ( const <a href="qstring.html">QString</a> & name, bool * ok = 0 ) const<tt> [pure virtual]</tt>
|
---|
| 176 | </h3>
|
---|
| 177 |
|
---|
| 178 | <p> If the reader has the property <em>name</em>, this function returns the
|
---|
| 179 | value of the property; otherwise the return value is undefined.
|
---|
| 180 | <p> If <em>ok</em> is not 0: if the reader has the <em>name</em> property <em>*ok</em>
|
---|
| 181 | is set to TRUE; otherwise <em>*ok</em> is set to FALSE.
|
---|
| 182 | <p> <p>See also <a href="#setProperty">setProperty</a>() and <a href="#hasProperty">hasProperty</a>().
|
---|
| 183 |
|
---|
| 184 | <h3 class=fn>void <a name="setContentHandler"></a>QXmlReader::setContentHandler ( <a href="qxmlcontenthandler.html">QXmlContentHandler</a> * handler )<tt> [pure virtual]</tt>
|
---|
| 185 | </h3>
|
---|
| 186 |
|
---|
| 187 | <p> Sets the content handler to <em>handler</em>.
|
---|
| 188 | <p> <p>See also <a href="#contentHandler">contentHandler</a>().
|
---|
| 189 |
|
---|
| 190 | <p>Example: <a href="xml-sax-walkthrough.html#x2140">xml/tagreader/tagreader.cpp</a>.
|
---|
| 191 | <h3 class=fn>void <a name="setDTDHandler"></a>QXmlReader::setDTDHandler ( <a href="qxmldtdhandler.html">QXmlDTDHandler</a> * handler )<tt> [pure virtual]</tt>
|
---|
| 192 | </h3>
|
---|
| 193 |
|
---|
| 194 | <p> Sets the DTD handler to <em>handler</em>.
|
---|
| 195 | <p> <p>See also <a href="#DTDHandler">DTDHandler</a>().
|
---|
| 196 |
|
---|
| 197 | <h3 class=fn>void <a name="setDeclHandler"></a>QXmlReader::setDeclHandler ( <a href="qxmldeclhandler.html">QXmlDeclHandler</a> * handler )<tt> [pure virtual]</tt>
|
---|
| 198 | </h3>
|
---|
| 199 |
|
---|
| 200 | <p> Sets the declaration handler to <em>handler</em>.
|
---|
| 201 | <p> <p>See also <a href="#declHandler">declHandler</a>().
|
---|
| 202 |
|
---|
| 203 | <h3 class=fn>void <a name="setEntityResolver"></a>QXmlReader::setEntityResolver ( <a href="qxmlentityresolver.html">QXmlEntityResolver</a> * handler )<tt> [pure virtual]</tt>
|
---|
| 204 | </h3>
|
---|
| 205 |
|
---|
| 206 | <p> Sets the entity resolver to <em>handler</em>.
|
---|
| 207 | <p> <p>See also <a href="#entityResolver">entityResolver</a>().
|
---|
| 208 |
|
---|
| 209 | <h3 class=fn>void <a name="setErrorHandler"></a>QXmlReader::setErrorHandler ( <a href="qxmlerrorhandler.html">QXmlErrorHandler</a> * handler )<tt> [pure virtual]</tt>
|
---|
| 210 | </h3>
|
---|
| 211 |
|
---|
| 212 | <p> Sets the error handler to <em>handler</em>. Clears the error handler if
|
---|
| 213 | <em>handler</em> is 0.
|
---|
| 214 | <p> <p>See also <a href="#errorHandler">errorHandler</a>().
|
---|
| 215 |
|
---|
| 216 | <h3 class=fn>void <a name="setFeature"></a>QXmlReader::setFeature ( const <a href="qstring.html">QString</a> & name, bool value )<tt> [pure virtual]</tt>
|
---|
| 217 | </h3>
|
---|
| 218 |
|
---|
| 219 | <p> Sets the feature called <em>name</em> to the given <em>value</em>. If the
|
---|
| 220 | reader doesn't have the feature nothing happens.
|
---|
| 221 | <p> <p>See also <a href="#feature">feature</a>() and <a href="#hasFeature">hasFeature</a>().
|
---|
| 222 |
|
---|
| 223 | <p>Reimplemented in <a href="qxmlsimplereader.html#setFeature">QXmlSimpleReader</a>.
|
---|
| 224 | <h3 class=fn>void <a name="setLexicalHandler"></a>QXmlReader::setLexicalHandler ( <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a> * handler )<tt> [pure virtual]</tt>
|
---|
| 225 | </h3>
|
---|
| 226 |
|
---|
| 227 | <p> Sets the lexical handler to <em>handler</em>.
|
---|
| 228 | <p> <p>See also <a href="#lexicalHandler">lexicalHandler</a>().
|
---|
| 229 |
|
---|
| 230 | <h3 class=fn>void <a name="setProperty"></a>QXmlReader::setProperty ( const <a href="qstring.html">QString</a> & name, void * value )<tt> [pure virtual]</tt>
|
---|
| 231 | </h3>
|
---|
| 232 |
|
---|
| 233 | <p> Sets the property <em>name</em> to <em>value</em>. If the reader doesn't have
|
---|
| 234 | the property nothing happens.
|
---|
| 235 | <p> <p>See also <a href="#property">property</a>() and <a href="#hasProperty">hasProperty</a>().
|
---|
| 236 |
|
---|
| 237 | <!-- eof -->
|
---|
| 238 | <hr><p>
|
---|
| 239 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 240 | Copyright © 1995-2007
|
---|
| 241 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 242 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 243 | <td>Copyright © 2007
|
---|
| 244 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 245 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 246 | </table></div></address></body>
|
---|
| 247 | </html>
|
---|