[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/xml/qxml.cpp:377 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QXmlNamespaceSupport Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <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>
|
---|
| 33 |
|
---|
| 34 | <p>The QXmlNamespaceSupport class is a helper class for XML
|
---|
| 35 | readers which want to include namespace support.
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
|
---|
| 38 | <p><tt>#include <<a href="qxml-h.html">qxml.h</a>></tt>
|
---|
| 39 | <p><a href="qxmlnamespacesupport-members.html">List of all member functions.</a>
|
---|
| 40 | <h2>Public Members</h2>
|
---|
| 41 | <ul>
|
---|
| 42 | <li class=fn><a href="#QXmlNamespaceSupport"><b>QXmlNamespaceSupport</b></a> ()</li>
|
---|
| 43 | <li class=fn><a href="#~QXmlNamespaceSupport"><b>~QXmlNamespaceSupport</b></a> ()</li>
|
---|
| 44 | <li class=fn>void <a href="#setPrefix"><b>setPrefix</b></a> ( const QString & pre, const QString & uri )</li>
|
---|
| 45 | <li class=fn>QString <a href="#prefix"><b>prefix</b></a> ( const QString & uri ) const</li>
|
---|
| 46 | <li class=fn>QString <a href="#uri"><b>uri</b></a> ( const QString & prefix ) const</li>
|
---|
| 47 | <li class=fn>void <a href="#splitName"><b>splitName</b></a> ( const QString & qname, QString & prefix, QString & localname ) const</li>
|
---|
| 48 | <li class=fn>void <a href="#processName"><b>processName</b></a> ( const QString & qname, bool isAttribute, QString & nsuri, QString & localname ) const</li>
|
---|
| 49 | <li class=fn>QStringList <a href="#prefixes"><b>prefixes</b></a> () const</li>
|
---|
| 50 | <li class=fn>QStringList <a href="#prefixes-2"><b>prefixes</b></a> ( const QString & uri ) const</li>
|
---|
| 51 | <li class=fn>void <a href="#pushContext"><b>pushContext</b></a> ()</li>
|
---|
| 52 | <li class=fn>void <a href="#popContext"><b>popContext</b></a> ()</li>
|
---|
| 53 | <li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
|
---|
| 54 | </ul>
|
---|
| 55 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | The QXmlNamespaceSupport class is a helper class for XML
|
---|
| 60 | readers which want to include namespace support.
|
---|
| 61 |
|
---|
| 62 | <p>
|
---|
| 63 |
|
---|
| 64 | <p> You can set the prefix for the current namespace with <a href="#setPrefix">setPrefix</a>(),
|
---|
| 65 | and get the list of current prefixes (or those for a given URI)
|
---|
| 66 | with <a href="#prefixes">prefixes</a>(). The namespace URI is available from <a href="#uri">uri</a>(). Use
|
---|
| 67 | <a href="#pushContext">pushContext</a>() to start a new namespace context, and <a href="#popContext">popContext</a>()
|
---|
| 68 | to return to the previous namespace context. Use <a href="#splitName">splitName</a>() or
|
---|
| 69 | <a href="#processName">processName</a>() to split a name into its prefix and local name.
|
---|
| 70 | <p> See also the <a href="xml.html#sax2Namespaces">namespace description</a>.
|
---|
| 71 | <p>See also <a href="xml-tools.html">XML</a>.
|
---|
| 72 |
|
---|
| 73 | <hr><h2>Member Function Documentation</h2>
|
---|
| 74 | <h3 class=fn><a name="QXmlNamespaceSupport"></a>QXmlNamespaceSupport::QXmlNamespaceSupport ()
|
---|
| 75 | </h3>
|
---|
| 76 | Constructs a QXmlNamespaceSupport.
|
---|
| 77 |
|
---|
| 78 | <h3 class=fn><a name="~QXmlNamespaceSupport"></a>QXmlNamespaceSupport::~QXmlNamespaceSupport ()
|
---|
| 79 | </h3>
|
---|
| 80 | Destroys a QXmlNamespaceSupport.
|
---|
| 81 |
|
---|
| 82 | <h3 class=fn>void <a name="popContext"></a>QXmlNamespaceSupport::popContext ()
|
---|
| 83 | </h3>
|
---|
| 84 | Reverts to the previous namespace context.
|
---|
| 85 | <p> Normally, you should pop the context at the end of each XML
|
---|
| 86 | element. After popping the context, all namespace prefix mappings
|
---|
| 87 | that were previously in force are restored.
|
---|
| 88 | <p> <p>See also <a href="#pushContext">pushContext</a>().
|
---|
| 89 |
|
---|
| 90 | <h3 class=fn><a href="qstring.html">QString</a> <a name="prefix"></a>QXmlNamespaceSupport::prefix ( const <a href="qstring.html">QString</a> & uri ) const
|
---|
| 91 | </h3>
|
---|
| 92 | Returns one of the prefixes mapped to the namespace URI <em>uri</em>.
|
---|
| 93 | <p> If more than one prefix is currently mapped to the same URI, this
|
---|
| 94 | function makes an arbitrary selection; if you want all of the
|
---|
| 95 | prefixes, use <a href="#prefixes">prefixes</a>() instead.
|
---|
| 96 | <p> Note: to check for a default prefix, use the <a href="#uri">uri</a>() function with
|
---|
| 97 | an argument of "".
|
---|
| 98 |
|
---|
| 99 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="prefixes"></a>QXmlNamespaceSupport::prefixes () const
|
---|
| 100 | </h3>
|
---|
| 101 | Returns a list of all the prefixes currently declared.
|
---|
| 102 | <p> If there is a default prefix, this function does not return it in
|
---|
| 103 | the list; check for the default prefix using <a href="#uri">uri</a>() with an
|
---|
| 104 | argument of "".
|
---|
| 105 | <p> Note that if you want to iterate over the list, you should iterate
|
---|
| 106 | over a copy, e.g.
|
---|
| 107 | <pre>
|
---|
| 108 | <a href="qstringlist.html">QStringList</a> list = myXmlNamespaceSupport.prefixes();
|
---|
| 109 | QStringList::iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
|
---|
| 110 | while ( it != list.<a href="qvaluelist.html#end">end</a>() ) {
|
---|
| 111 | myProcessing( *it );
|
---|
| 112 | ++it;
|
---|
| 113 | }
|
---|
| 114 | </pre>
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="prefixes-2"></a>QXmlNamespaceSupport::prefixes ( const <a href="qstring.html">QString</a> & uri ) const
|
---|
| 118 | </h3>
|
---|
| 119 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 120 | <p> Returns a list of all prefixes currently declared for the
|
---|
| 121 | namespace URI <em>uri</em>.
|
---|
| 122 | <p> The "xml:" prefix is included. If you only want one prefix that is
|
---|
| 123 | mapped to the namespace URI, and you don't care which one you get,
|
---|
| 124 | use the <a href="#prefix">prefix</a>() function instead.
|
---|
| 125 | <p> Note: the empty (default) prefix is never included in this list;
|
---|
| 126 | to check for the presence of a default namespace, use <a href="#uri">uri</a>() with
|
---|
| 127 | an argument of "".
|
---|
| 128 | <p> Note that if you want to iterate over the list, you should iterate
|
---|
| 129 | over a copy, e.g.
|
---|
| 130 | <pre>
|
---|
| 131 | <a href="qstringlist.html">QStringList</a> list = myXmlNamespaceSupport.prefixes( "" );
|
---|
| 132 | QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
|
---|
| 133 | while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
|
---|
| 134 | myProcessing( *it );
|
---|
| 135 | ++it;
|
---|
| 136 | }
|
---|
| 137 | </pre>
|
---|
| 138 |
|
---|
| 139 |
|
---|
| 140 | <h3 class=fn>void <a name="processName"></a>QXmlNamespaceSupport::processName ( const <a href="qstring.html">QString</a> & qname, bool isAttribute, <a href="qstring.html">QString</a> & nsuri, <a href="qstring.html">QString</a> & localname ) const
|
---|
| 141 | </h3>
|
---|
| 142 | Processes a raw XML 1.0 name in the current context by removing
|
---|
| 143 | the prefix and looking it up among the prefixes currently
|
---|
| 144 | declared.
|
---|
| 145 | <p> <em>qname</em> is the raw XML 1.0 name to be processed. <em>isAttribute</em>
|
---|
| 146 | is TRUE if the name is an attribute name.
|
---|
| 147 | <p> This function stores the namespace URI in <em>nsuri</em> (which will be
|
---|
| 148 | set to <a href="qstring.html#QString-null">QString::null</a> if the raw name has an undeclared prefix),
|
---|
| 149 | and stores the local name (without prefix) in <em>localname</em> (which
|
---|
| 150 | will be set to QString::null if no namespace is in use).
|
---|
| 151 | <p> Note that attribute names are processed differently than element
|
---|
| 152 | names: an unprefixed element name gets the default namespace (if
|
---|
| 153 | any), while an unprefixed element name does not.
|
---|
| 154 |
|
---|
| 155 | <h3 class=fn>void <a name="pushContext"></a>QXmlNamespaceSupport::pushContext ()
|
---|
| 156 | </h3>
|
---|
| 157 | Starts a new namespace context.
|
---|
| 158 | <p> Normally, you should push a new context at the beginning of each
|
---|
| 159 | XML element: the new context automatically inherits the
|
---|
| 160 | declarations of its parent context, and it also keeps track of
|
---|
| 161 | which declarations were made within this context.
|
---|
| 162 | <p> <p>See also <a href="#popContext">popContext</a>().
|
---|
| 163 |
|
---|
| 164 | <h3 class=fn>void <a name="reset"></a>QXmlNamespaceSupport::reset ()
|
---|
| 165 | </h3>
|
---|
| 166 | Resets this namespace support object ready for reuse.
|
---|
| 167 |
|
---|
| 168 | <h3 class=fn>void <a name="setPrefix"></a>QXmlNamespaceSupport::setPrefix ( const <a href="qstring.html">QString</a> & pre, const <a href="qstring.html">QString</a> & uri )
|
---|
| 169 | </h3>
|
---|
| 170 | This function declares a prefix <em>pre</em> in the current namespace
|
---|
| 171 | context to be the namespace URI <em>uri</em>. The prefix remains in
|
---|
| 172 | force until this context is popped, unless it is shadowed in a
|
---|
| 173 | descendant context.
|
---|
| 174 | <p> Note that there is an asymmetry in this library. <a href="#prefix">prefix</a>() does not
|
---|
| 175 | return the default "" prefix, even if you have declared one; to
|
---|
| 176 | check for a default prefix, you must look it up explicitly using
|
---|
| 177 | <a href="#uri">uri</a>(). This asymmetry exists to make it easier to look up prefixes
|
---|
| 178 | for attribute names, where the default prefix is not allowed.
|
---|
| 179 |
|
---|
| 180 | <h3 class=fn>void <a name="splitName"></a>QXmlNamespaceSupport::splitName ( const <a href="qstring.html">QString</a> & qname, <a href="qstring.html">QString</a> & prefix, <a href="qstring.html">QString</a> & localname ) const
|
---|
| 181 | </h3>
|
---|
| 182 | Splits the name <em>qname</em> at the ':' and returns the prefix in <em>prefix</em> and the local name in <em>localname</em>.
|
---|
| 183 | <p> <p>See also <a href="#processName">processName</a>().
|
---|
| 184 |
|
---|
| 185 | <h3 class=fn><a href="qstring.html">QString</a> <a name="uri"></a>QXmlNamespaceSupport::uri ( const <a href="qstring.html">QString</a> & prefix ) const
|
---|
| 186 | </h3>
|
---|
| 187 | Looks up the prefix <em>prefix</em> in the current context and returns
|
---|
| 188 | the currently-mapped namespace URI. Use the empty string ("") for
|
---|
| 189 | the default namespace.
|
---|
| 190 |
|
---|
| 191 | <!-- eof -->
|
---|
| 192 | <hr><p>
|
---|
| 193 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 194 | Copyright © 1995-2007
|
---|
| 195 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 196 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 197 | <td>Copyright © 2007
|
---|
| 198 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 199 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 200 | </table></div></address></body>
|
---|
| 201 | </html>
|
---|