You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/tqxmlnamespacesupport.html

202 lines
11 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/xml/tqxml.cpp:377 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQXmlNamespaceSupport Class</title>
<style type="text/css"><!--
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>TQXmlNamespaceSupport Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
<p>The TQXmlNamespaceSupport class is a helper class for XML
readers which want to include namespace support.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include &lt;<a href="tqxml-h.html">tqxml.h</a>&gt;</tt>
<p><a href="tqxmlnamespacesupport-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQXmlNamespaceSupport"><b>TQXmlNamespaceSupport</b></a> ()</li>
<li class=fn><a href="#~TQXmlNamespaceSupport"><b>~TQXmlNamespaceSupport</b></a> ()</li>
<li class=fn>void <a href="#setPrefix"><b>setPrefix</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;pre, const&nbsp;TQString&nbsp;&amp;&nbsp;uri )</li>
<li class=fn>TQString <a href="#prefix"><b>prefix</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;uri ) const</li>
<li class=fn>TQString <a href="#uri"><b>uri</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;prefix ) const</li>
<li class=fn>void <a href="#splitName"><b>splitName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;qname, TQString&nbsp;&amp;&nbsp;prefix, TQString&nbsp;&amp;&nbsp;localname ) const</li>
<li class=fn>void <a href="#processName"><b>processName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;qname, bool&nbsp;isAttribute, TQString&nbsp;&amp;&nbsp;nsuri, TQString&nbsp;&amp;&nbsp;localname ) const</li>
<li class=fn>TQStringList <a href="#prefixes"><b>prefixes</b></a> () const</li>
<li class=fn>TQStringList <a href="#prefixes-2"><b>prefixes</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;uri ) const</li>
<li class=fn>void <a href="#pushContext"><b>pushContext</b></a> ()</li>
<li class=fn>void <a href="#popContext"><b>popContext</b></a> ()</li>
<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQXmlNamespaceSupport 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="#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 and local 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="TQXmlNamespaceSupport"></a>TQXmlNamespaceSupport::TQXmlNamespaceSupport ()
</h3>
Constructs a TQXmlNamespaceSupport.
<h3 class=fn><a name="~TQXmlNamespaceSupport"></a>TQXmlNamespaceSupport::~TQXmlNamespaceSupport ()
</h3>
Destroys a TQXmlNamespaceSupport.
<h3 class=fn>void <a name="popContext"></a>TQXmlNamespaceSupport::popContext ()
</h3>
Reverts to the previous namespace context.
<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>See also <a href="#pushContext">pushContext</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="prefix"></a>TQXmlNamespaceSupport::prefix ( const&nbsp;<a href="ntqstring.html">TQString</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
function makes 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
an argument of "".
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="prefixes"></a>TQXmlNamespaceSupport::prefixes () const
</h3>
Returns a list of all the prefixes currently declared.
<p> If there is a default prefix, this function does not return it in
the list; check for the default prefix using <a href="#uri">uri</a>() with an
argument of "".
<p> Note that if you want to iterate over the list, you should iterate
over a copy, e.g.
<pre>
<a href="ntqstringlist.html">TQStringList</a> list = myXmlNamespaceSupport.prefixes();
TQStringList::iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>();
while ( it != list.<a href="ntqvaluelist.html#end">end</a>() ) {
myProcessing( *it );
++it;
}
</pre>
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="prefixes-2"></a>TQXmlNamespaceSupport::prefixes ( const&nbsp;<a href="ntqstring.html">TQString</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 is
mapped 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;
to check for the presence of a default namespace, use <a href="#uri">uri</a>() with
an argument of "".
<p> Note that if you want to iterate over the list, you should iterate
over a copy, e.g.
<pre>
<a href="ntqstringlist.html">TQStringList</a> list = myXmlNamespaceSupport.prefixes( "" );
TQStringList::Iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>();
while( it != list.<a href="ntqvaluelist.html#end">end</a>() ) {
myProcessing( *it );
++it;
}
</pre>
<h3 class=fn>void <a name="processName"></a>TQXmlNamespaceSupport::processName ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;qname, bool&nbsp;isAttribute, <a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;nsuri, <a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;localname ) const
</h3>
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> <em>qname</em> is the raw XML 1.0 name to be processed. <em>isAttribute</em>
is TRUE if the name is an attribute name.
<p> This function stores the namespace URI in <em>nsuri</em> (which will be
set to <a href="ntqstring.html#TQString-null">TQString::null</a> if the raw name has an undeclared prefix),
and stores the local name (without prefix) in <em>localname</em> (which
will be set to TQString::null if no namespace is in use).
<p> Note that attribute names are processed differently than element
names: an unprefixed element name gets the default namespace (if
any), while an unprefixed element name does not.
<h3 class=fn>void <a name="pushContext"></a>TQXmlNamespaceSupport::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 parent context, and it also keeps track of
which declarations were made within this context.
<p> <p>See also <a href="#popContext">popContext</a>().
<h3 class=fn>void <a name="reset"></a>TQXmlNamespaceSupport::reset ()
</h3>
Resets this namespace support object ready for reuse.
<h3 class=fn>void <a name="setPrefix"></a>TQXmlNamespaceSupport::setPrefix ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;pre, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;uri )
</h3>
This function declares a prefix <em>pre</em> in the current namespace
context to be the namespace URI <em>uri</em>. The prefix remains in
force until this context is 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 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="#uri">uri</a>(). This asymmetry 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>TQXmlNamespaceSupport::splitName ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;qname, <a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;prefix, <a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;localname ) const
</h3>
Splits the name <em>qname</em> at the ':' and returns the prefix in <em>prefix</em> and the local name in <em>localname</em>.
<p> <p>See also <a href="#processName">processName</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="uri"></a>TQXmlNamespaceSupport::uri ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;prefix ) const
</h3>
Looks up the prefix <em>prefix</em> in the current context and returns
the currently-mapped namespace URI. Use the empty string ("") for
the default namespace.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<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; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>