qxmlnamespacesupport.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 198 行

HTML
198
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/xml/qxml.cpp:376 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QXmlNamespaceSupport Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QXmlNamespaceSupport Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1><p>The QXmlNamespaceSupport class is a helper class for XML readers whichwant to include namespace support.<a href="#details">More...</a><p><tt>#include &lt;<a href="qxml-h.html">qxml.h</a>&gt;</tt><p><a href="qxmlnamespacesupport-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QXmlNamespaceSupport"><b>QXmlNamespaceSupport</b></a> ()</div></li><li><div class=fn><a href="#~QXmlNamespaceSupport"><b>~QXmlNamespaceSupport</b></a> ()</div></li><li><div class=fn>void <a href="#setPrefix"><b>setPrefix</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;pre, const&nbsp;QString&nbsp;&amp;&nbsp;uri )</div></li><li><div class=fn>QString <a href="#prefix"><b>prefix</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;uri ) const</div></li><li><div class=fn>QString <a href="#uri"><b>uri</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;prefix ) const</div></li><li><div class=fn>void <a href="#splitName"><b>splitName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;qname, QString&nbsp;&amp;&nbsp;prefix, QString&nbsp;&amp;&nbsp;localname ) const</div></li><li><div class=fn>void <a href="#processName"><b>processName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;qname, bool&nbsp;isAttribute, QString&nbsp;&amp;&nbsp;nsuri, QString&nbsp;&amp;&nbsp;localname ) const</div></li><li><div class=fn>QStringList <a href="#prefixes"><b>prefixes</b></a> () const</div></li><li><div class=fn>QStringList <a href="#prefixes-2"><b>prefixes</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;uri ) const</div></li><li><div class=fn>void <a href="#pushContext"><b>pushContext</b></a> ()</div></li><li><div class=fn>void <a href="#popContext"><b>popContext</b></a> ()</div></li><li><div class=fn>void <a href="#reset"><b>reset</b></a> ()</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QXmlNamespaceSupport class is a helper class for XML readers whichwant to include namespace support.<p> <p> You can set the prefix for the current namespace with <a href="#setPrefix">setPrefix</a>(),and get the list of current prefixes (or those for a given URI)with <a href="#prefixes">prefixes</a>(). The namespace URI is available from <a href="#uri">uri</a>(). Use<a href="#pushContext">pushContext</a>() to start a new namespace context, and <a href="#popContext">popContext</a>()to return to the previous namespace context. Use<a href="#splitName">splitName</a>() or <a href="#processName">processName</a>() to split a name into its prefix andlocal name.<p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.<p>See also <a href="xml-tools.html">XML</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QXmlNamespaceSupport"></a>QXmlNamespaceSupport::QXmlNamespaceSupport ()</h3>Constructs a QXmlNamespaceSupport.<h3 class=fn><a name="~QXmlNamespaceSupport"></a>QXmlNamespaceSupport::~QXmlNamespaceSupport ()</h3>Destroys a QXmlNamespaceSupport.<h3 class=fn>void <a name="popContext"></a>QXmlNamespaceSupport::popContext ()</h3>Reverts to the previous namespace context.<p> Normally, you should pop the context at the end of each XML element.  Afterpopping the context, all namespace prefix mappings that were previously inforce are restored.<p> <p>See also <a href="#pushContext">pushContext</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="prefix"></a>QXmlNamespaceSupport::prefix ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;uri ) const</h3>Returns one of the prefixes mapped to the namespace URI <em>uri</em>.<p> If more than one prefix is currently mapped to the same URI, this functionmakes an arbitrary selection; if you want all of the prefixes, use<a href="#prefixes">prefixes</a>() instead.<p> Note: to check for a default prefix, use the <a href="#uri">uri</a>() function with anargument of "".<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="prefixes"></a>QXmlNamespaceSupport::prefixes () const</h3>Returns a list of all prefixes currently declared.<p> If there is a default prefix, this function does not return it in thelist; check for the default prefix using <a href="#uri">uri</a>() with an argumentof "".<p> Note that if you want to iterate over the list, you shoulditerate over a copy, e.g.<pre>    <a href="qstringlist.html">QStringList</a> list = myXmlNamespaceSupport.prefixes();    QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {        myProcessing( *it );        ++it;    }    </pre> <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="prefixes-2"></a>QXmlNamespaceSupport::prefixes ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;uri ) const</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> Returns a list of all prefixes currently declared for the namespace URI <em>uri</em>.<p> The "xml:" prefix is included. If you only want one prefix that ismapped to the namespace URI, and you don't care which one you get, use the<a href="#prefix">prefix</a>() function instead.<p> Note: the empty (default) prefix is never included in this list; tocheck for the presence of a default namespace, use <a href="#uri">uri</a>() with anargument of "".<p> Note that if you want to iterate over the list, you shoulditerate over a copy, e.g.<pre>    <a href="qstringlist.html">QStringList</a> list = myXmlNamespaceSupport.prefixes( "" );    QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {        myProcessing( *it );        ++it;    }    </pre> <h3 class=fn>void <a name="processName"></a>QXmlNamespaceSupport::processName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;qname, bool&nbsp;isAttribute, <a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;nsuri, <a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;localname ) const</h3>Processes a raw XML 1.0 name in the current context by removing the prefixand looking it up among the prefixes currently declared.<p> <em>qname</em> is the raw XML 1.0 name to be processed. <em>isAttribute</em> isTRUE if the name is an attribute name.<p> This function stores the namespace URI in <em>nsuri</em> (which will get anull string if the raw name has an undeclared prefix), and storesthe local name (without prefix) in <em>localname</em> (which will get anull string if no namespace is in use).<p> Note that attribute names are processed differently than element names: anunprefixed element name gets the default namespace (if any), whilean unprefixed element name does not.<h3 class=fn>void <a name="pushContext"></a>QXmlNamespaceSupport::pushContext ()</h3>Starts a new namespace context.<p> Normally, you should push a new context at the beginning of each XML element:the new context automatically inherits the declarations of its parentcontext, and it also keeps track of which declarations were made withinthis context.<p> <p>See also <a href="#popContext">popContext</a>().<h3 class=fn>void <a name="reset"></a>QXmlNamespaceSupport::reset ()</h3>Resets this namespace support object for reuse.<h3 class=fn>void <a name="setPrefix"></a>QXmlNamespaceSupport::setPrefix ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;pre, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;uri )</h3>This function declares a prefix <em>pre</em> in the current namespace context to bethe namespace URI <em>uri</em>. The prefix remains in force until this contextis popped, unless it is shadowed in a descendant context.<p> Note that there is an asymmetry in this library. <a href="#prefix">prefix</a>() does notreturn the default "" prefix, even if you have declared one; to check for adefault prefix, you must look it up explicitly using <a href="#uri">uri</a>(). Thisasymmetry exists to make it easier to look up prefixes for attribute names,where the default prefix is not allowed.<h3 class=fn>void <a name="splitName"></a>QXmlNamespaceSupport::splitName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;qname, <a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;prefix, <a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;localname ) const</h3>Splits the name <em>qname</em> at the ':' and returns the prefix in <em>prefix</em> andthe local name in <em>localname</em>.<p> <p>See also <a href="#processName">processName</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="uri"></a>QXmlNamespaceSupport::uri ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;prefix ) const</h3>Looks up the prefix <em>prefix</em> in the current context and returns thecurrently-mapped namespace URI. Use the empty string ("") for the defaultnamespace.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright &copy; 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?