~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qxmldefaulthandler.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/xml/qxml.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QXmlDefaultHandler Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QXmlDefaultHandler Class Reference</h1>
 
21
<p>The QXmlDefaultHandler class provides a default implementation of all the XML handler classes. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QXmlDefaultHandler&gt;</pre><p>Part of the <a href="qtxml.html">QtXml</a> module.</p>
 
23
<p>Inherits <a href="qxmlcontenthandler.html">QXmlContentHandler</a>, <a href="qxmlerrorhandler.html">QXmlErrorHandler</a>, <a href="qxmldtdhandler.html">QXmlDTDHandler</a>, <a href="qxmlentityresolver.html">QXmlEntityResolver</a>, <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a>, and <a href="qxmldeclhandler.html">QXmlDeclHandler</a>.</p>
 
24
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
 
25
<ul>
 
26
<li><a href="qxmldefaulthandler-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="public-functions"></a>
 
29
<h3>Public Functions</h3>
 
30
<ul>
 
31
<li><div class="fn"/><b><a href="qxmldefaulthandler.html#QXmlDefaultHandler">QXmlDefaultHandler</a></b> ()</li>
 
32
<li><div class="fn"/>virtual <b><a href="qxmldefaulthandler.html#dtor.QXmlDefaultHandler">~QXmlDefaultHandler</a></b> ()</li>
 
33
</ul>
 
34
<ul>
 
35
<li><div class="fn"/>12 public functions inherited from <a href="qxmlcontenthandler.html#public-functions">QXmlContentHandler</a></li>
 
36
<li><div class="fn"/>4 public functions inherited from <a href="qxmlerrorhandler.html#public-functions">QXmlErrorHandler</a></li>
 
37
<li><div class="fn"/>3 public functions inherited from <a href="qxmldtdhandler.html#public-functions">QXmlDTDHandler</a></li>
 
38
<li><div class="fn"/>2 public functions inherited from <a href="qxmlentityresolver.html#public-functions">QXmlEntityResolver</a></li>
 
39
<li><div class="fn"/>8 public functions inherited from <a href="qxmllexicalhandler.html#public-functions">QXmlLexicalHandler</a></li>
 
40
<li><div class="fn"/>4 public functions inherited from <a href="qxmldeclhandler.html#public-functions">QXmlDeclHandler</a></li>
 
41
</ul>
 
42
<a name="details"></a>
 
43
<hr />
 
44
<h2>Detailed Description</h2>
 
45
<p>The QXmlDefaultHandler class provides a default implementation of all the XML handler classes.</p>
 
46
<p>This class gathers together the features of the specialized handler classes, making it a convenient starting point when implementing custom handlers for subclasses of <a href="qxmlreader.html">QXmlReader</a>, particularly <a href="qxmlsimplereader.html">QXmlSimpleReader</a>. The virtual functions from each of the base classes are reimplemented in this class, providing sensible default behavior for many common cases. By subclassing this class, and overriding these functions, you can concentrate on implementing the parts of the handler relevant to your application.</p>
 
47
<p>The XML reader must be told which handler to use for different kinds of events during parsing. This means that, although QXmlDefaultHandler provides default implementations of functions inherited from all its base classes, we can still use specialized handlers for particular kinds of events.</p>
 
48
<p>For example, QXmlDefaultHandler subclasses both <a href="qxmlcontenthandler.html">QXmlContentHandler</a> and <a href="qxmlerrorhandler.html">QXmlErrorHandler</a>, so by subclassing it we can use the same handler for both of the following reader functions:</p>
 
49
<pre>&nbsp;       xmlReader.setContentHandler(handler);
 
50
        xmlReader.setErrorHandler(handler);</pre>
 
51
<p>Since the reader will inform the handler of parsing errors, it is necessary to reimplement <a href="qxmlerrorhandler.html#fatalError">QXmlErrorHandler::fatalError</a>() if, for example, we want to stop parsing when such an error occurs:</p>
 
52
<pre>&nbsp;   bool Handler::fatalError (const QXmlParseException &amp; exception)
 
53
    {
 
54
        qWarning() &lt;&lt; &quot;Fatal error on line&quot; &lt;&lt; exception.lineNumber()
 
55
                   &lt;&lt; &quot;, column&quot; &lt;&lt; exception.columnNumber() &lt;&lt; &quot;:&quot;
 
56
                   &lt;&lt; exception.message();
 
57
 
 
58
        return false;
 
59
    }</pre>
 
60
<p>The above function returns false, which tells the reader to stop parsing. To continue to use the same reader, it is necessary to create a new handler instance, and set up the reader to use it in the manner described above.</p>
 
61
<p>It is useful to examine some of the functions inherited by QXmlDefaultHandler, and consider why they might be reimplemented in a custom handler. Custom handlers will typically reimplement <a href="qxmlcontenthandler.html#startDocument">QXmlContentHandler::startDocument</a>() to prepare the handler for new content. Document elements and the text within them can be processed by reimplementing <a href="qxmlcontenthandler.html#startElement">QXmlContentHandler::startElement</a>(), <a href="qxmlcontenthandler.html#endElement">QXmlContentHandler::endElement</a>(), and <a href="qxmlcontenthandler.html#characters">QXmlContentHandler::characters</a>(). You may want to reimplement <a href="qxmlcontenthandler.html#endDocument">QXmlContentHandler::endDocument</a>() to perform some finalization or validation on the content once the document has been read completely.</p>
 
62
<p>See the qt/examples/xml/rsslisting example for more information on creating a custom handler.</p>
 
63
<p>See also the <a href="xml.html#sax2intro">Introduction to SAX2</a>.</p>
 
64
<p><a href="qxmlerrorhandler.html">QXmlErrorHandler</a> <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a></p>
 
65
<p>See also <a href="qxmldtdhandler.html">QXmlDTDHandler</a>, <a href="qxmldeclhandler.html">QXmlDeclHandler</a>, <a href="qxmlcontenthandler.html">QXmlContentHandler</a>, and <a href="qxmlentityresolver.html">QXmlEntityResolver</a>.</p>
 
66
<hr />
 
67
<h2>Member Function Documentation</h2>
 
68
<h3 class="fn"><a name="QXmlDefaultHandler"></a>QXmlDefaultHandler::QXmlDefaultHandler ()</h3>
 
69
<p>Constructs a handler for use with subclasses of <a href="qxmlreader.html">QXmlReader</a>.</p>
 
70
<h3 class="fn"><a name="dtor.QXmlDefaultHandler"></a>QXmlDefaultHandler::~QXmlDefaultHandler ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
71
<p>Destroys the handler.</p>
 
72
<p /><address><hr /><div align="center">
 
73
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
74
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
75
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
76
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
77
</tr></table></div></address></body>
 
78
</html>