File: qxmldefaulthandler.html

package info (click to toggle)
python-qt4 4.9.3-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,432 kB
  • sloc: python: 34,126; cpp: 11,938; xml: 290; makefile: 223; php: 27
file content (177 lines) | stat: -rw-r--r-- 19,620 bytes parent folder | download
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QXmlDefaultHandler Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QXmlDefaultHandler Class Reference<br /><sup><sup>[<a href="qtxml.html">QtXml</a> module]</sup></sup></h1><p>The QXmlDefaultHandler class provides a default implementation
of all the XML handler classes. <a href="#details">More...</a></p>

<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><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qxmldefaulthandler.html#QXmlDefaultHandler">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#attributeDecl">attributeDecl</a></b> (<i>self</i>, QString&#160;<i>eName</i>, QString&#160;<i>aName</i>, QString&#160;<i>type</i>, QString&#160;<i>valueDefault</i>, QString&#160;<i>value</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#characters">characters</a></b> (<i>self</i>, QString&#160;<i>ch</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#comment">comment</a></b> (<i>self</i>, QString&#160;<i>ch</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endCDATA">endCDATA</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endDocument">endDocument</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endDTD">endDTD</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endElement">endElement</a></b> (<i>self</i>, QString&#160;<i>namespaceURI</i>, QString&#160;<i>localName</i>, QString&#160;<i>qName</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endEntity">endEntity</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endPrefixMapping">endPrefixMapping</a></b> (<i>self</i>, QString&#160;<i>prefix</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#error">error</a></b> (<i>self</i>, QXmlParseException&#160;<i>exception</i>)</li><li><div class="fn" />QString <b><a href="qxmldefaulthandler.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#externalEntityDecl">externalEntityDecl</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#fatalError">fatalError</a></b> (<i>self</i>, QXmlParseException&#160;<i>exception</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#ignorableWhitespace">ignorableWhitespace</a></b> (<i>self</i>, QString&#160;<i>ch</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#internalEntityDecl">internalEntityDecl</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>value</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#notationDecl">notationDecl</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#processingInstruction">processingInstruction</a></b> (<i>self</i>, QString&#160;<i>target</i>, QString&#160;<i>data</i>)</li><li><div class="fn" />(bool, QXmlInputSource&#160;<i>ret</i>) <b><a href="qxmldefaulthandler.html#resolveEntity">resolveEntity</a></b> (<i>self</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</li><li><div class="fn" /><b><a href="qxmldefaulthandler.html#setDocumentLocator">setDocumentLocator</a></b> (<i>self</i>, QXmlLocator&#160;<i>locator</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#skippedEntity">skippedEntity</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startCDATA">startCDATA</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startDocument">startDocument</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startDTD">startDTD</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startElement">startElement</a></b> (<i>self</i>, QString&#160;<i>namespaceURI</i>, QString&#160;<i>localName</i>, QString&#160;<i>qName</i>, QXmlAttributes&#160;<i>atts</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startEntity">startEntity</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startPrefixMapping">startPrefixMapping</a></b> (<i>self</i>, QString&#160;<i>prefix</i>, QString&#160;<i>uri</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#unparsedEntityDecl">unparsedEntityDecl</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>, QString&#160;<i>notationName</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#warning">warning</a></b> (<i>self</i>, QXmlParseException&#160;<i>exception</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QXmlDefaultHandler class provides a default implementation
of all the XML handler classes.</p>
<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>
<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>
<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>
<pre class="cpp">
     xmlReader<span class="operator">.</span>setContentHandler(handler);
     xmlReader<span class="operator">.</span>setErrorHandler(handler);
</pre>
<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>
<pre class="cpp">
 <span class="type">bool</span> Handler<span class="operator">.</span><a href="qxmldefaulthandler.html#fatalError">fatalError</a> (<span class="keyword">const</span> <span class="type"><a href="qxmlparseexception.html">QXmlParseException</a></span> <span class="operator">&amp;</span> exception)
 {
     <a href="qtcore.html#qWarning">qWarning</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"Fatal error on line"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> exception<span class="operator">.</span>lineNumber()
                <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">", column"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> exception<span class="operator">.</span>columnNumber() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">":"</span>
                <span class="operator">&lt;</span><span class="operator">&lt;</span> exception<span class="operator">.</span>message();

     <span class="keyword">return</span> <span class="keyword">false</span>;
 }
</pre>
<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>
<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>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QXmlDefaultHandler" />QXmlDefaultHandler.__init__ (<i>self</i>)</h3><p>Constructs a handler for use with subclasses of <a href="qxmlreader.html">QXmlReader</a>.</p>


<h3 class="fn"><a name="attributeDecl" />bool QXmlDefaultHandler.attributeDecl (<i>self</i>, QString&#160;<i>eName</i>, QString&#160;<i>aName</i>, QString&#160;<i>type</i>, QString&#160;<i>valueDefault</i>, QString&#160;<i>value</i>)</h3><p>Reimplemented from <a href="qxmldeclhandler.html#attributeDecl">QXmlDeclHandler.attributeDecl</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="characters" />bool QXmlDefaultHandler.characters (<i>self</i>, QString&#160;<i>ch</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#characters">QXmlContentHandler.characters</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="comment" />bool QXmlDefaultHandler.comment (<i>self</i>, QString&#160;<i>ch</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#comment">QXmlLexicalHandler.comment</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="endCDATA" />bool QXmlDefaultHandler.endCDATA (<i>self</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#endCDATA">QXmlLexicalHandler.endCDATA</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="endDocument" />bool QXmlDefaultHandler.endDocument (<i>self</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#endDocument">QXmlContentHandler.endDocument</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="endDTD" />bool QXmlDefaultHandler.endDTD (<i>self</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#endDTD">QXmlLexicalHandler.endDTD</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="endElement" />bool QXmlDefaultHandler.endElement (<i>self</i>, QString&#160;<i>namespaceURI</i>, QString&#160;<i>localName</i>, QString&#160;<i>qName</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#endElement">QXmlContentHandler.endElement</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="endEntity" />bool QXmlDefaultHandler.endEntity (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#endEntity">QXmlLexicalHandler.endEntity</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="endPrefixMapping" />bool QXmlDefaultHandler.endPrefixMapping (<i>self</i>, QString&#160;<i>prefix</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#endPrefixMapping">QXmlContentHandler.endPrefixMapping</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="error" />bool QXmlDefaultHandler.error (<i>self</i>, <a href="qxmlparseexception.html">QXmlParseException</a>&#160;<i>exception</i>)</h3><p>Reimplemented from <a href="qxmlerrorhandler.html#error">QXmlErrorHandler.error</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="errorString" />QString QXmlDefaultHandler.errorString (<i>self</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#errorString">QXmlContentHandler.errorString</a>().</p>
<p>Returns the default error string.</p>


<h3 class="fn"><a name="externalEntityDecl" />bool QXmlDefaultHandler.externalEntityDecl (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</h3><p>Reimplemented from <a href="qxmldeclhandler.html#externalEntityDecl">QXmlDeclHandler.externalEntityDecl</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="fatalError" />bool QXmlDefaultHandler.fatalError (<i>self</i>, <a href="qxmlparseexception.html">QXmlParseException</a>&#160;<i>exception</i>)</h3><p>Reimplemented from <a href="qxmlerrorhandler.html#fatalError">QXmlErrorHandler.fatalError</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="ignorableWhitespace" />bool QXmlDefaultHandler.ignorableWhitespace (<i>self</i>, QString&#160;<i>ch</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#ignorableWhitespace">QXmlContentHandler.ignorableWhitespace</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="internalEntityDecl" />bool QXmlDefaultHandler.internalEntityDecl (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>value</i>)</h3><p>Reimplemented from <a href="qxmldeclhandler.html#internalEntityDecl">QXmlDeclHandler.internalEntityDecl</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="notationDecl" />bool QXmlDefaultHandler.notationDecl (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</h3><p>Reimplemented from <a href="qxmldtdhandler.html#notationDecl">QXmlDTDHandler.notationDecl</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="processingInstruction" />bool QXmlDefaultHandler.processingInstruction (<i>self</i>, QString&#160;<i>target</i>, QString&#160;<i>data</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#processingInstruction">QXmlContentHandler.processingInstruction</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="resolveEntity" />(bool, <a href="qxmlinputsource.html">QXmlInputSource</a>&#160;<i>ret</i>) QXmlDefaultHandler.resolveEntity (<i>self</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</h3><p>Reimplemented from <a href="qxmlentityresolver.html#resolveEntity">QXmlEntityResolver.resolveEntity</a>().</p>
<p>Sets <i>ret</i> to 0, so that the reader uses the system
identifier provided in the XML document.</p>


<h3 class="fn"><a name="setDocumentLocator" />QXmlDefaultHandler.setDocumentLocator (<i>self</i>, <a href="qxmllocator.html">QXmlLocator</a>&#160;<i>locator</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#setDocumentLocator">QXmlContentHandler.setDocumentLocator</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="skippedEntity" />bool QXmlDefaultHandler.skippedEntity (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#skippedEntity">QXmlContentHandler.skippedEntity</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="startCDATA" />bool QXmlDefaultHandler.startCDATA (<i>self</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#startCDATA">QXmlLexicalHandler.startCDATA</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="startDocument" />bool QXmlDefaultHandler.startDocument (<i>self</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#startDocument">QXmlContentHandler.startDocument</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="startDTD" />bool QXmlDefaultHandler.startDTD (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#startDTD">QXmlLexicalHandler.startDTD</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="startElement" />bool QXmlDefaultHandler.startElement (<i>self</i>, QString&#160;<i>namespaceURI</i>, QString&#160;<i>localName</i>, QString&#160;<i>qName</i>, <a href="qxmlattributes.html">QXmlAttributes</a>&#160;<i>atts</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#startElement">QXmlContentHandler.startElement</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="startEntity" />bool QXmlDefaultHandler.startEntity (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Reimplemented from <a href="qxmllexicalhandler.html#startEntity">QXmlLexicalHandler.startEntity</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="startPrefixMapping" />bool QXmlDefaultHandler.startPrefixMapping (<i>self</i>, QString&#160;<i>prefix</i>, QString&#160;<i>uri</i>)</h3><p>Reimplemented from <a href="qxmlcontenthandler.html#startPrefixMapping">QXmlContentHandler.startPrefixMapping</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="unparsedEntityDecl" />bool QXmlDefaultHandler.unparsedEntityDecl (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>publicId</i>, QString&#160;<i>systemId</i>, QString&#160;<i>notationName</i>)</h3><p>Reimplemented from <a href="qxmldtdhandler.html#unparsedEntityDecl">QXmlDTDHandler.unparsedEntityDecl</a>().</p>
<p>This reimplementation does nothing.</p>


<h3 class="fn"><a name="warning" />bool QXmlDefaultHandler.warning (<i>self</i>, <a href="qxmlparseexception.html">QXmlParseException</a>&#160;<i>exception</i>)</h3><p>Reimplemented from <a href="qxmlerrorhandler.html#warning">QXmlErrorHandler.warning</a>().</p>
<p>This reimplementation does nothing.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.2</td></tr></table></div></address></body></html>