1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
'\" t
.TH QXmlNamespaceSupport 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QXmlNamespaceSupport \- Helper class for XML readers which want to include namespace support
.SH SYNOPSIS
All the functions in this class are reentrant when TQt is built with thread support.</p>
.PP
\fC#include <ntqxml.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQXmlNamespaceSupport\fR ()"
.br
.ti -1c
.BI "\fB~QXmlNamespaceSupport\fR ()"
.br
.ti -1c
.BI "void \fBsetPrefix\fR ( const TQString & pre, const TQString & uri )"
.br
.ti -1c
.BI "TQString \fBprefix\fR ( const TQString & uri ) const"
.br
.ti -1c
.BI "TQString \fBuri\fR ( const TQString & prefix ) const"
.br
.ti -1c
.BI "void \fBsplitName\fR ( const TQString & qname, TQString & prefix, TQString & localname ) const"
.br
.ti -1c
.BI "void \fBprocessName\fR ( const TQString & qname, bool isAttribute, TQString & nsuri, TQString & localname ) const"
.br
.ti -1c
.BI "QStringList \fBprefixes\fR () const"
.br
.ti -1c
.BI "QStringList \fBprefixes\fR ( const TQString & uri ) const"
.br
.ti -1c
.BI "void \fBpushContext\fR ()"
.br
.ti -1c
.BI "void \fBpopContext\fR ()"
.br
.ti -1c
.BI "void \fBreset\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support.
.PP
You can set the prefix for the current namespace with setPrefix(), and get the list of current prefixes (or those for a given URI) with prefixes(). The namespace URI is available from uri(). Use pushContext() to start a new namespace context, and popContext() to return to the previous namespace context. Use splitName() or processName() to split a name into its prefix and local name.
.PP
See also the namespace description.
.PP
See also XML.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QXmlNamespaceSupport::QXmlNamespaceSupport ()"
Constructs a QXmlNamespaceSupport.
.SH "QXmlNamespaceSupport::~QXmlNamespaceSupport ()"
Destroys a QXmlNamespaceSupport.
.SH "void QXmlNamespaceSupport::popContext ()"
Reverts to the previous namespace context.
.PP
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.
.PP
See also pushContext().
.SH "TQString QXmlNamespaceSupport::prefix ( const TQString & uri ) const"
Returns one of the prefixes mapped to the namespace URI \fIuri\fR.
.PP
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 prefixes() instead.
.PP
Note: to check for a default prefix, use the uri() function with an argument of "".
.SH "QStringList QXmlNamespaceSupport::prefixes () const"
Returns a list of all the prefixes currently declared.
.PP
If there is a default prefix, this function does not return it in the list; check for the default prefix using uri() with an argument of "".
.PP
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
.PP
.nf
.br
QStringList list = myXmlNamespaceSupport.prefixes();
.br
QStringList::iterator it = list.begin();
.br
while ( it != list.end() ) {
.br
myProcessing( *it );
.br
++it;
.br
}
.br
.fi
.SH "QStringList QXmlNamespaceSupport::prefixes ( const TQString & uri ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns a list of all prefixes currently declared for the namespace URI \fIuri\fR.
.PP
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 prefix() function instead.
.PP
Note: the empty (default) prefix is never included in this list; to check for the presence of a default namespace, use uri() with an argument of "".
.PP
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
.PP
.nf
.br
QStringList list = myXmlNamespaceSupport.prefixes( "" );
.br
QStringList::Iterator it = list.begin();
.br
while( it != list.end() ) {
.br
myProcessing( *it );
.br
++it;
.br
}
.br
.fi
.SH "void QXmlNamespaceSupport::processName ( const TQString & qname, bool isAttribute, TQString & nsuri, TQString & localname ) const"
Processes a raw XML 1.0 name in the current context by removing the prefix and looking it up among the prefixes currently declared.
.PP
\fIqname\fR is the raw XML 1.0 name to be processed. \fIisAttribute\fR is TRUE if the name is an attribute name.
.PP
This function stores the namespace URI in \fInsuri\fR (which will be set to TQString::null if the raw name has an undeclared prefix), and stores the local name (without prefix) in \fIlocalname\fR (which will be set to TQString::null if no namespace is in use).
.PP
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.
.SH "void QXmlNamespaceSupport::pushContext ()"
Starts a new namespace context.
.PP
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.
.PP
See also popContext().
.SH "void QXmlNamespaceSupport::reset ()"
Resets this namespace support object ready for reuse.
.SH "void QXmlNamespaceSupport::setPrefix ( const TQString & pre, const TQString & uri )"
This function declares a prefix \fIpre\fR in the current namespace context to be the namespace URI \fIuri\fR. The prefix remains in force until this context is popped, unless it is shadowed in a descendant context.
.PP
Note that there is an asymmetry in this library. prefix() 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 uri(). This asymmetry exists to make it easier to look up prefixes for attribute names, where the default prefix is not allowed.
.SH "void QXmlNamespaceSupport::splitName ( const TQString & qname, TQString & prefix, TQString & localname ) const"
Splits the name \fIqname\fR at the ':' and returns the prefix in \fIprefix\fR and the local name in \fIlocalname\fR.
.PP
See also processName().
.SH "TQString QXmlNamespaceSupport::uri ( const TQString & prefix ) const"
Looks up the prefix \fIprefix\fR in the current context and returns
the currently-mapped namespace URI. Use the empty string ("") for
the default namespace.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qxmlnamespacesupport.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqxmlnamespacesupport.3qt) and the Qt
version (3.3.8).
|