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.
202 lines
10 KiB
202 lines
10 KiB
14 years ago
|
<!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/qxml.cpp:377 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QXmlNamespaceSupport 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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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 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 Qt is built with thread support.</p>
|
||
|
<p><tt>#include <<a href="qxml-h.html">qxml.h</a>></tt>
|
||
|
<p><a href="qxmlnamespacesupport-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#QXmlNamespaceSupport"><b>QXmlNamespaceSupport</b></a> ()</li>
|
||
|
<li class=fn><a href="#~QXmlNamespaceSupport"><b>~QXmlNamespaceSupport</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#setPrefix"><b>setPrefix</b></a> ( const QString & pre, const QString & uri )</li>
|
||
|
<li class=fn>QString <a href="#prefix"><b>prefix</b></a> ( const QString & uri ) const</li>
|
||
|
<li class=fn>QString <a href="#uri"><b>uri</b></a> ( const QString & prefix ) const</li>
|
||
|
<li class=fn>void <a href="#splitName"><b>splitName</b></a> ( const QString & qname, QString & prefix, QString & localname ) const</li>
|
||
|
<li class=fn>void <a href="#processName"><b>processName</b></a> ( const QString & qname, bool isAttribute, QString & nsuri, QString & localname ) const</li>
|
||
|
<li class=fn>QStringList <a href="#prefixes"><b>prefixes</b></a> () const</li>
|
||
|
<li class=fn>QStringList <a href="#prefixes-2"><b>prefixes</b></a> ( const QString & 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 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="#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="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. 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="qstring.html">QString</a> <a name="prefix"></a>QXmlNamespaceSupport::prefix ( const <a href="qstring.html">QString</a> & 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="qstringlist.html">QStringList</a> <a name="prefixes"></a>QXmlNamespaceSupport::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="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 <a href="qstring.html">QString</a> & 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="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 <a href="qstring.html">QString</a> & qname, bool isAttribute, <a href="qstring.html">QString</a> & nsuri, <a href="qstring.html">QString</a> & 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="qstring.html#QString-null">QString::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 QString::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>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 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>QXmlNamespaceSupport::reset ()
|
||
|
</h3>
|
||
|
Resets this namespace support object ready for reuse.
|
||
|
|
||
|
<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 )
|
||
|
</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>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
|
||
|
</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="qstring.html">QString</a> <a name="uri"></a>QXmlNamespaceSupport::uri ( const <a href="qstring.html">QString</a> & 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">Qt toolkit</a>.
|
||
|
Copyright © 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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|