source: trunk/doc/html/qxmlnamespacesupport.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 10.7 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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
35readers 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 &lt;<a href="qxml-h.html">qxml.h</a>&gt;</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&nbsp;QString&nbsp;&amp;&nbsp;pre, const&nbsp;QString&nbsp;&amp;&nbsp;uri )</li>
45<li class=fn>QString <a href="#prefix"><b>prefix</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;uri ) const</li>
46<li class=fn>QString <a href="#uri"><b>uri</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;prefix ) const</li>
47<li 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</li>
48<li 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</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&nbsp;QString&nbsp;&amp;&nbsp;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
59The QXmlNamespaceSupport class is a helper class for XML
60readers 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>(),
65and get the list of current prefixes (or those for a given URI)
66with <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>()
68to 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>
76Constructs a QXmlNamespaceSupport.
77
78<h3 class=fn><a name="~QXmlNamespaceSupport"></a>QXmlNamespaceSupport::~QXmlNamespaceSupport ()
79</h3>
80Destroys a QXmlNamespaceSupport.
81
82<h3 class=fn>void <a name="popContext"></a>QXmlNamespaceSupport::popContext ()
83</h3>
84Reverts to the previous namespace context.
85<p> Normally, you should pop the context at the end of each XML
86element. After popping the context, all namespace prefix mappings
87that 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;uri ) const
91</h3>
92Returns 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
94function makes an arbitrary selection; if you want all of the
95prefixes, 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
97an argument of "".
98
99<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="prefixes"></a>QXmlNamespaceSupport::prefixes () const
100</h3>
101Returns a list of all the prefixes currently declared.
102<p> If there is a default prefix, this function does not return it in
103the list; check for the default prefix using <a href="#uri">uri</a>() with an
104argument of "".
105<p> Note that if you want to iterate over the list, you should iterate
106over 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;uri ) const
118</h3>
119This 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
121namespace URI <em>uri</em>.
122<p> The "xml:" prefix is included. If you only want one prefix that is
123mapped to the namespace URI, and you don't care which one you get,
124use the <a href="#prefix">prefix</a>() function instead.
125<p> Note: the empty (default) prefix is never included in this list;
126to check for the presence of a default namespace, use <a href="#uri">uri</a>() with
127an argument of "".
128<p> Note that if you want to iterate over the list, you should iterate
129over 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&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
141</h3>
142Processes a raw XML 1.0 name in the current context by removing
143the prefix and looking it up among the prefixes currently
144declared.
145<p> <em>qname</em> is the raw XML 1.0 name to be processed. <em>isAttribute</em>
146is TRUE if the name is an attribute name.
147<p> This function stores the namespace URI in <em>nsuri</em> (which will be
148set to <a href="qstring.html#QString-null">QString::null</a> if the raw name has an undeclared prefix),
149and stores the local name (without prefix) in <em>localname</em> (which
150will be set to QString::null if no namespace is in use).
151<p> Note that attribute names are processed differently than element
152names: an unprefixed element name gets the default namespace (if
153any), while an unprefixed element name does not.
154
155<h3 class=fn>void <a name="pushContext"></a>QXmlNamespaceSupport::pushContext ()
156</h3>
157Starts a new namespace context.
158<p> Normally, you should push a new context at the beginning of each
159XML element: the new context automatically inherits the
160declarations of its parent context, and it also keeps track of
161which 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>
166Resets this namespace support object ready for reuse.
167
168<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 )
169</h3>
170This function declares a prefix <em>pre</em> in the current namespace
171context to be the namespace URI <em>uri</em>. The prefix remains in
172force until this context is popped, unless it is shadowed in a
173descendant context.
174<p> Note that there is an asymmetry in this library. <a href="#prefix">prefix</a>() does not
175return the default "" prefix, even if you have declared one; to
176check 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
178for attribute names, where the default prefix is not allowed.
179
180<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
181</h3>
182Splits 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;prefix ) const
186</h3>
187Looks up the prefix <em>prefix</em> in the current context and returns
188the currently-mapped namespace URI. Use the empty string ("") for
189the default namespace.
190
191<!-- eof -->
192<hr><p>
193This file is part of the <a href="index.html">Qt toolkit</a>.
194Copyright &copy; 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.