<?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">  </td><td class="postheader" 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="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 <i>eName</i>, QString <i>aName</i>, QString <i>type</i>, QString <i>valueDefault</i>, QString <i>value</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#characters">characters</a></b> (<i>self</i>, QString <i>ch</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#comment">comment</a></b> (<i>self</i>, QString <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 <i>namespaceURI</i>, QString <i>localName</i>, QString <i>qName</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endEntity">endEntity</a></b> (<i>self</i>, QString <i>name</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#endPrefixMapping">endPrefixMapping</a></b> (<i>self</i>, QString <i>prefix</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#error">error</a></b> (<i>self</i>, QXmlParseException <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 <i>name</i>, QString <i>publicId</i>, QString <i>systemId</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#fatalError">fatalError</a></b> (<i>self</i>, QXmlParseException <i>exception</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#ignorableWhitespace">ignorableWhitespace</a></b> (<i>self</i>, QString <i>ch</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#internalEntityDecl">internalEntityDecl</a></b> (<i>self</i>, QString <i>name</i>, QString <i>value</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#notationDecl">notationDecl</a></b> (<i>self</i>, QString <i>name</i>, QString <i>publicId</i>, QString <i>systemId</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#processingInstruction">processingInstruction</a></b> (<i>self</i>, QString <i>target</i>, QString <i>data</i>)</li><li><div class="fn" />(bool, QXmlInputSource <i>ret</i>) <b><a href="qxmldefaulthandler.html#resolveEntity">resolveEntity</a></b> (<i>self</i>, QString <i>publicId</i>, QString <i>systemId</i>)</li><li><div class="fn" /><b><a href="qxmldefaulthandler.html#setDocumentLocator">setDocumentLocator</a></b> (<i>self</i>, QXmlLocator <i>locator</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#skippedEntity">skippedEntity</a></b> (<i>self</i>, QString <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 <i>name</i>, QString <i>publicId</i>, QString <i>systemId</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startElement">startElement</a></b> (<i>self</i>, QString <i>namespaceURI</i>, QString <i>localName</i>, QString <i>qName</i>, QXmlAttributes <i>atts</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startEntity">startEntity</a></b> (<i>self</i>, QString <i>name</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#startPrefixMapping">startPrefixMapping</a></b> (<i>self</i>, QString <i>prefix</i>, QString <i>uri</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#unparsedEntityDecl">unparsedEntityDecl</a></b> (<i>self</i>, QString <i>name</i>, QString <i>publicId</i>, QString <i>systemId</i>, QString <i>notationName</i>)</li><li><div class="fn" />bool <b><a href="qxmldefaulthandler.html#warning">warning</a></b> (<i>self</i>, QXmlParseException <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">&</span> exception) { <a href="qtcore.html#qWarning">qWarning</a>() <span class="operator"><</span><span class="operator"><</span> <span class="string">"Fatal error on line"</span> <span class="operator"><</span><span class="operator"><</span> exception<span class="operator">.</span>lineNumber() <span class="operator"><</span><span class="operator"><</span> <span class="string">", column"</span> <span class="operator"><</span><span class="operator"><</span> exception<span class="operator">.</span>columnNumber() <span class="operator"><</span><span class="operator"><</span> <span class="string">":"</span> <span class="operator"><</span><span class="operator"><</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 <i>eName</i>, QString <i>aName</i>, QString <i>type</i>, QString <i>valueDefault</i>, QString <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 <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 <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 <i>namespaceURI</i>, QString <i>localName</i>, QString <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 <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 <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> <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 <i>name</i>, QString <i>publicId</i>, QString <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> <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 <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 <i>name</i>, QString <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 <i>name</i>, QString <i>publicId</i>, QString <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 <i>target</i>, QString <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> <i>ret</i>) QXmlDefaultHandler.resolveEntity (<i>self</i>, QString <i>publicId</i>, QString <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> <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 <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 <i>name</i>, QString <i>publicId</i>, QString <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 <i>namespaceURI</i>, QString <i>localName</i>, QString <i>qName</i>, <a href="qxmlattributes.html">QXmlAttributes</a> <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 <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 <i>prefix</i>, QString <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 <i>name</i>, QString <i>publicId</i>, QString <i>systemId</i>, QString <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> <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 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>