<?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>QXmlNamespaceSupport 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">QXmlNamespaceSupport Class Reference<br /><sup><sup>[<a href="qtxml.html">QtXml</a> module]</sup></sup></h1><p>The QXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#QXmlNamespaceSupport">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#popContext">popContext</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qxmlnamespacesupport.html#prefix">prefix</a></b> (<i>self</i>, QString)</li><li><div class="fn" />QStringList <b><a href="qxmlnamespacesupport.html#prefixes">prefixes</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qxmlnamespacesupport.html#prefixes-2">prefixes</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#processName">processName</a></b> (<i>self</i>, QString, bool, QString, QString)</li><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#pushContext">pushContext</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#setPrefix">setPrefix</a></b> (<i>self</i>, QString, QString)</li><li><div class="fn" /><b><a href="qxmlnamespacesupport.html#splitName">splitName</a></b> (<i>self</i>, QString, QString, QString)</li><li><div class="fn" />QString <b><a href="qxmlnamespacesupport.html#uri">uri</a></b> (<i>self</i>, QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support.</p> <p>You can set the prefix for the current namespace with <a href="qxmlnamespacesupport.html#setPrefix">setPrefix</a>(), and get the list of current prefixes (or those for a given URI) with <a href="qxmlnamespacesupport.html#prefixes">prefixes</a>(). The namespace URI is available from <a href="qxmlnamespacesupport.html#uri">uri</a>(). Use <a href="qxmlnamespacesupport.html#pushContext">pushContext</a>() to start a new namespace context, and <a href="qxmlnamespacesupport.html#popContext">popContext</a>() to return to the previous namespace context. Use <a href="qxmlnamespacesupport.html#splitName">splitName</a>() or <a href="qxmlnamespacesupport.html#processName">processName</a>() to split a name into its prefix and local name.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QXmlNamespaceSupport" />QXmlNamespaceSupport.__init__ (<i>self</i>)</h3><p>Constructs a <a href="qxmlnamespacesupport.html">QXmlNamespaceSupport</a>.</p> <h3 class="fn"><a name="popContext" />QXmlNamespaceSupport.popContext (<i>self</i>)</h3><p>Reverts to the previous namespace context.</p> <p>Normally, you should pop the context at the end of each XML element. After popping the context, all namespace prefix mappings that were previously in force are restored.</p> <p><b>See also</b> <a href="qxmlnamespacesupport.html#pushContext">pushContext</a>().</p> <h3 class="fn"><a name="prefix" />QString QXmlNamespaceSupport.prefix (<i>self</i>, QString)</h3><p>Returns one of the prefixes mapped to the namespace URI <i>uri</i>.</p> <p>If more than one prefix is currently mapped to the same URI, this function makes an arbitrary selection; if you want all of the prefixes, use <a href="qxmlnamespacesupport.html#prefixes">prefixes</a>() instead.</p> <p>Note: to check for a default prefix, use the <a href="qxmlnamespacesupport.html#uri">uri</a>() function with an argument of "".</p> <p><b>See also</b> <a href="qxmlnamespacesupport.html#setPrefix">setPrefix</a>().</p> <h3 class="fn"><a name="prefixes" />QStringList QXmlNamespaceSupport.prefixes (<i>self</i>)</h3><p>Returns a list of all the prefixes currently declared.</p> <p>If there is a default prefix, this function does not return it in the list; check for the default prefix using <a href="qxmlnamespacesupport.html#uri">uri</a>() with an argument of "".</p> <h3 class="fn"><a name="prefixes-2" />QStringList QXmlNamespaceSupport.prefixes (<i>self</i>, QString)</h3><p>This is an overloaded function.</p> <p>Returns a list of all prefixes currently declared for the namespace URI <i>uri</i>.</p> <p>The "xml:" prefix is included. If you only want one prefix that is mapped to the namespace URI, and you don't care which one you get, use the <a href="qxmlnamespacesupport.html#prefix">prefix</a>() function instead.</p> <p>Note: The empty (default) prefix is never included in this list; to check for the presence of a default namespace, call <a href="qxmlnamespacesupport.html#uri">uri</a>() with "" as the argument.</p> <h3 class="fn"><a name="processName" />QXmlNamespaceSupport.processName (<i>self</i>, QString, bool, QString, QString)</h3><p>Processes a raw XML 1.0 name in the current context by removing the prefix and looking it up among the prefixes currently declared.</p> <p><i>qname</i> is the raw XML 1.0 name to be processed. <i>isAttribute</i> is true if the name is an attribute name.</p> <p>This function stores the namespace URI in <i>nsuri</i> (which will be set to an empty string if the raw name has an undeclared prefix), and stores the local name (without prefix) in <i>localname</i> (which will be set to an empty string if no namespace is in use).</p> <p>Note that attribute names are processed differently than element names: an unprefixed element name gets the default namespace (if any), while an unprefixed attribute name does not.</p> <h3 class="fn"><a name="pushContext" />QXmlNamespaceSupport.pushContext (<i>self</i>)</h3><p>Starts a new namespace context.</p> <p>Normally, you should push a new context at the beginning of each XML element: the new context automatically inherits the declarations of its parent context, and it also keeps track of which declarations were made within this context.</p> <p><b>See also</b> <a href="qxmlnamespacesupport.html#popContext">popContext</a>().</p> <h3 class="fn"><a name="reset" />QXmlNamespaceSupport.reset (<i>self</i>)</h3><p>Resets this namespace support object ready for reuse.</p> <h3 class="fn"><a name="setPrefix" />QXmlNamespaceSupport.setPrefix (<i>self</i>, QString, QString)</h3><p>This function declares a prefix <i>pre</i> in the current namespace context to be the namespace URI <i>uri</i>. The prefix remains in force until this context is popped, unless it is shadowed in a descendant context.</p> <p>Note that there is an asymmetry in this library. <a href="qxmlnamespacesupport.html#prefix">prefix</a>() does not return the default "" prefix, even if you have declared one; to check for a default prefix, you must look it up explicitly using <a href="qxmlnamespacesupport.html#uri">uri</a>(). This asymmetry exists to make it easier to look up prefixes for attribute names, where the default prefix is not allowed.</p> <p><b>See also</b> <a href="qxmlnamespacesupport.html#prefix">prefix</a>().</p> <h3 class="fn"><a name="splitName" />QXmlNamespaceSupport.splitName (<i>self</i>, QString, QString, QString)</h3><p>Splits the name <i>qname</i> at the ':' and returns the prefix in <i>prefix</i> and the local name in <i>localname</i>.</p> <p><b>See also</b> <a href="qxmlnamespacesupport.html#processName">processName</a>().</p> <h3 class="fn"><a name="uri" />QString QXmlNamespaceSupport.uri (<i>self</i>, QString)</h3><p>Looks up the prefix <i>prefix</i> in the current context and returns the currently-mapped namespace URI. Use the empty string ("") for the default namespace.</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>