1QXmlNamespaceSupport(3qt)                            QXmlNamespaceSupport(3qt)
2
3
4

NAME

6       QXmlNamespaceSupport - Helper class for XML readers which want to
7       include namespace support
8

SYNOPSIS

10       All the functions in this class are reentrant when Qt is built with
11       thread support.</p>
12
13       #include <qxml.h>
14
15   Public Members
16       QXmlNamespaceSupport ()
17       ~QXmlNamespaceSupport ()
18       void setPrefix ( const QString & pre, const QString & uri )
19       QString prefix ( const QString & uri ) const
20       QString uri ( const QString & prefix ) const
21       void splitName ( const QString & qname, QString & prefix, QString &
22           localname ) const
23       void processName ( const QString & qname, bool isAttribute, QString &
24           nsuri, QString & localname ) const
25       QStringList prefixes () const
26       QStringList prefixes ( const QString & uri ) const
27       void pushContext ()
28       void popContext ()
29       void reset ()
30

DESCRIPTION

32       The QXmlNamespaceSupport class is a helper class for XML readers which
33       want to include namespace support.
34
35       You can set the prefix for the current namespace with setPrefix(), and
36       get the list of current prefixes (or those for a given URI) with
37       prefixes(). The namespace URI is available from uri(). Use
38       pushContext() to start a new namespace context, and popContext() to
39       return to the previous namespace context. Use splitName() or
40       processName() to split a name into its prefix and local name.
41
42       See also the namespace description.
43
44       See also XML.
45

MEMBER FUNCTION DOCUMENTATION

QXmlNamespaceSupport::QXmlNamespaceSupport ()

48       Constructs a QXmlNamespaceSupport.
49

QXmlNamespaceSupport::~QXmlNamespaceSupport ()

51       Destroys a QXmlNamespaceSupport.
52

void QXmlNamespaceSupport::popContext ()

54       Reverts to the previous namespace context.
55
56       Normally, you should pop the context at the end of each XML element.
57       After popping the context, all namespace prefix mappings that were
58       previously in force are restored.
59
60       See also pushContext().
61

QString QXmlNamespaceSupport::prefix ( const QString & uri ) const

63       Returns one of the prefixes mapped to the namespace URI uri.
64
65       If more than one prefix is currently mapped to the same URI, this
66       function makes an arbitrary selection; if you want all of the prefixes,
67       use prefixes() instead.
68
69       Note: to check for a default prefix, use the uri() function with an
70       argument of "".
71

QStringList QXmlNamespaceSupport::prefixes () const

73       Returns a list of all the prefixes currently declared.
74
75       If there is a default prefix, this function does not return it in the
76       list; check for the default prefix using uri() with an argument of "".
77
78       Note that if you want to iterate over the list, you should iterate over
79       a copy, e.g.
80
81           QStringList list = myXmlNamespaceSupport.prefixes();
82           QStringList::iterator it = list.begin();
83           while ( it != list.end() ) {
84               myProcessing( *it );
85               ++it;
86           }
87

QStringList QXmlNamespaceSupport::prefixes ( const QString & uri ) const

89       This is an overloaded member function, provided for convenience. It
90       behaves essentially like the above function.
91
92       Returns a list of all prefixes currently declared for the namespace URI
93       uri.
94
95       The "xml:" prefix is included. If you only want one prefix that is
96       mapped to the namespace URI, and you don't care which one you get, use
97       the prefix() function instead.
98
99       Note: the empty (default) prefix is never included in this list; to
100       check for the presence of a default namespace, use uri() with an
101       argument of "".
102
103       Note that if you want to iterate over the list, you should iterate over
104       a copy, e.g.
105
106           QStringList list = myXmlNamespaceSupport.prefixes( "" );
107           QStringList::Iterator it = list.begin();
108           while( it != list.end() ) {
109               myProcessing( *it );
110               ++it;
111           }
112

void QXmlNamespaceSupport::processName ( const QString & qname, bool

114       isAttribute, QString & nsuri, QString & localname ) const
115       Processes a raw XML 1.0 name in the current context by removing the
116       prefix and looking it up among the prefixes currently declared.
117
118       qname is the raw XML 1.0 name to be processed. isAttribute is TRUE if
119       the name is an attribute name.
120
121       This function stores the namespace URI in nsuri (which will be set to
122       QString::null if the raw name has an undeclared prefix), and stores the
123       local name (without prefix) in localname (which will be set to
124       QString::null if no namespace is in use).
125
126       Note that attribute names are processed differently than element names:
127       an unprefixed element name gets the default namespace (if any), while
128       an unprefixed element name does not.
129

void QXmlNamespaceSupport::pushContext ()

131       Starts a new namespace context.
132
133       Normally, you should push a new context at the beginning of each XML
134       element: the new context automatically inherits the declarations of its
135       parent context, and it also keeps track of which declarations were made
136       within this context.
137
138       See also popContext().
139

void QXmlNamespaceSupport::reset ()

141       Resets this namespace support object ready for reuse.
142

void QXmlNamespaceSupport::setPrefix ( const QString & pre, const QString &

144       uri )
145       This function declares a prefix pre in the current namespace context to
146       be the namespace URI uri. The prefix remains in force until this
147       context is popped, unless it is shadowed in a descendant context.
148
149       Note that there is an asymmetry in this library. prefix() does not
150       return the default "" prefix, even if you have declared one; to check
151       for a default prefix, you must look it up explicitly using uri(). This
152       asymmetry exists to make it easier to look up prefixes for attribute
153       names, where the default prefix is not allowed.
154

void QXmlNamespaceSupport::splitName ( const QString & qname, QString &

156       prefix, QString & localname ) const
157       Splits the name qname at the ':' and returns the prefix in prefix and
158       the local name in localname.
159
160       See also processName().
161

QString QXmlNamespaceSupport::uri ( const QString & prefix ) const

163       Looks up the prefix prefix in the current context and returns the
164       currently-mapped namespace URI. Use the empty string ("") for the
165       default namespace.
166
167

SEE ALSO

169       http://doc.trolltech.com/qxmlnamespacesupport.html
170       http://www.trolltech.com/faq/tech.html
171
173       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
174       license file included in the distribution for a complete license
175       statement.
176

AUTHOR

178       Generated automatically from the source code.
179

BUGS

181       If you find a bug in Qt, please report it as described in
182       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
183       help you. Thank you.
184
185       The definitive Qt documentation is provided in HTML format; it is
186       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
187       web browser. This man page is provided as a convenience for those users
188       who prefer man pages, although this format is not officially supported
189       by Trolltech.
190
191       If you find errors in this manual page, please report them to qt-
192       bugs@trolltech.com.  Please include the name of the manual page
193       (qxmlnamespacesupport.3qt) and the Qt version (3.3.8).
194
195
196
197Trolltech AS                    2 February 2007      QXmlNamespaceSupport(3qt)
Impressum