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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
|
<!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/tqdom.cpp:6043 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDomDocument 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>TQDomDocument Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
<p>The TQDomDocument class represents an XML document.
<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 <<a href="tqdom-h.html">tqdom.h</a>></tt>
<p>Inherits <a href="tqdomnode.html">TQDomNode</a>.
<p><a href="tqdomdocument-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDomDocument"><b>TQDomDocument</b></a> ()</li>
<li class=fn>explicit <a href="#TQDomDocument-2"><b>TQDomDocument</b></a> ( const TQString & name )</li>
<li class=fn>explicit <a href="#TQDomDocument-3"><b>TQDomDocument</b></a> ( const TQDomDocumentType & doctype )</li>
<li class=fn><a href="#TQDomDocument-4"><b>TQDomDocument</b></a> ( const TQDomDocument & x )</li>
<li class=fn>TQDomDocument & <a href="#operator-eq"><b>operator=</b></a> ( const TQDomDocument & x )</li>
<li class=fn><a href="#~TQDomDocument"><b>~TQDomDocument</b></a> ()</li>
<li class=fn>TQDomElement <a href="#createElement"><b>createElement</b></a> ( const TQString & tagName )</li>
<li class=fn>TQDomDocumentFragment <a href="#createDocumentFragment"><b>createDocumentFragment</b></a> ()</li>
<li class=fn>TQDomText <a href="#createTextNode"><b>createTextNode</b></a> ( const TQString & value )</li>
<li class=fn>TQDomComment <a href="#createComment"><b>createComment</b></a> ( const TQString & value )</li>
<li class=fn>TQDomCDATASection <a href="#createCDATASection"><b>createCDATASection</b></a> ( const TQString & value )</li>
<li class=fn>TQDomProcessingInstruction <a href="#createProcessingInstruction"><b>createProcessingInstruction</b></a> ( const TQString & target, const TQString & data )</li>
<li class=fn>TQDomAttr <a href="#createAttribute"><b>createAttribute</b></a> ( const TQString & name )</li>
<li class=fn>TQDomEntityReference <a href="#createEntityReference"><b>createEntityReference</b></a> ( const TQString & name )</li>
<li class=fn>TQDomNodeList <a href="#elementsByTagName"><b>elementsByTagName</b></a> ( const TQString & tagname ) const</li>
<li class=fn>TQDomNode <a href="#importNode"><b>importNode</b></a> ( const TQDomNode & importedNode, bool deep )</li>
<li class=fn>TQDomElement <a href="#createElementNS"><b>createElementNS</b></a> ( const TQString & nsURI, const TQString & qName )</li>
<li class=fn>TQDomAttr <a href="#createAttributeNS"><b>createAttributeNS</b></a> ( const TQString & nsURI, const TQString & qName )</li>
<li class=fn>TQDomNodeList <a href="#elementsByTagNameNS"><b>elementsByTagNameNS</b></a> ( const TQString & nsURI, const TQString & localName )</li>
<li class=fn>TQDomElement <a href="#elementById"><b>elementById</b></a> ( const TQString & elementId )</li>
<li class=fn>TQDomDocumentType <a href="#doctype"><b>doctype</b></a> () const</li>
<li class=fn>TQDomImplementation <a href="#implementation"><b>implementation</b></a> () const</li>
<li class=fn>TQDomElement <a href="#documentElement"><b>documentElement</b></a> () const</li>
<li class=fn>bool <a href="#setContent-2"><b>setContent</b></a> ( const TQCString & buffer, bool namespaceProcessing, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent"><b>setContent</b></a> ( const TQByteArray & buffer, bool namespaceProcessing, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-3"><b>setContent</b></a> ( const TQString & text, bool namespaceProcessing, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-4"><b>setContent</b></a> ( TQIODevice * dev, bool namespaceProcessing, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-5"><b>setContent</b></a> ( const TQCString & buffer, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-6"><b>setContent</b></a> ( const TQByteArray & buffer, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-7"><b>setContent</b></a> ( const TQString & text, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-8"><b>setContent</b></a> ( TQIODevice * dev, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>bool <a href="#setContent-9"><b>setContent</b></a> ( TQXmlInputSource * source, TQXmlReader * reader, TQString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )</li>
<li class=fn>virtual TQDomNode::NodeType <a href="#nodeType"><b>nodeType</b></a> () const</li>
<li class=fn>virtual bool <a href="#isDocument"><b>isDocument</b></a> () const</li>
<li class=fn>TQString <a href="#toString"><b>toString</b></a> () const</li>
<li class=fn>TQString <a href="#toString-2"><b>toString</b></a> ( int indent ) const</li>
<li class=fn>TQCString <a href="#toCString"><b>toCString</b></a> () const</li>
<li class=fn>TQCString <a href="#toCString-2"><b>toCString</b></a> ( int indent ) const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQDomDocument class represents an XML document.
<p>
<p> The TQDomDocument class represents the entire XML document.
Conceptually, it is the root of the document tree, and provides
the primary access to the document's data.
<p> Since elements, text nodes, comments, processing instructions,
etc., cannot exist outside the context of a document, the document
class also contains the factory functions needed to create these
objects. The node objects created have an <a href="tqdomnode.html#ownerDocument">ownerDocument</a>() function
which associates them with the document within whose context they
were created. The DOM classes that will be used most often are
<a href="tqdomnode.html">TQDomNode</a>, TQDomDocument, <a href="tqdomelement.html">TQDomElement</a> and <a href="tqdomtext.html">TQDomText</a>.
<p> The parsed XML is represented internally by a tree of objects that
can be accessed using the various TQDom classes. All TQDom classes
only <em>reference</em> objects in the internal tree. The internal
objects in the DOM tree will get deleted once the last TQDom
object referencing them and the TQDomDocument itself are deleted.
<p> Creation of elements, text nodes, etc. is done using the various
factory functions provided in this class. Using the default
constructors of the TQDom classes will only result in empty
objects that cannot be manipulated or inserted into the Document.
<p> The TQDomDocument class has several functions for creating document
data, for example, <a href="#createElement">createElement</a>(), <a href="#createTextNode">createTextNode</a>(),
<a href="#createComment">createComment</a>(), <a href="#createCDATASection">createCDATASection</a>(),
<a href="#createProcessingInstruction">createProcessingInstruction</a>(), <a href="#createAttribute">createAttribute</a>() and
<a href="#createEntityReference">createEntityReference</a>(). Some of these functions have versions
that support namespaces, i.e. <a href="#createElementNS">createElementNS</a>() and
<a href="#createAttributeNS">createAttributeNS</a>(). The <a href="#createDocumentFragment">createDocumentFragment</a>() function is used
to hold parts of the document; this is useful for manipulating for
complex documents.
<p> The entire content of the document is set with <a href="#setContent">setContent</a>(). This
function parses the string it is passed as an XML document and
creates the DOM tree that represents the document. The root
element is available using <a href="#documentElement">documentElement</a>(). The textual
representation of the document can be obtained using <a href="#toString">toString</a>().
<p> It is possible to insert a node from another document into the
document using <a href="#importNode">importNode</a>().
<p> You can obtain a list of all the elements that have a particular
tag with <a href="#elementsByTagName">elementsByTagName</a>() or with <a href="#elementsByTagNameNS">elementsByTagNameNS</a>().
<p> The TQDom classes are typically used as follows:
<pre>
TQDomDocument doc( "mydocument" );
<a href="ntqfile.html">TQFile</a> file( "mydocument.xml" );
if ( !file.<a href="ntqfile.html#open">open</a>( <a href="ntqfile.html#open">IO_ReadOnly</a> ) )
return;
if ( !doc.<a href="#setContent">setContent</a>( &file ) ) {
file.<a href="ntqfile.html#close">close</a>();
return;
}
file.<a href="ntqfile.html#close">close</a>();
// print out the element names of all elements that are direct children
// of the outermost element.
<a href="tqdomelement.html">TQDomElement</a> docElem = doc.<a href="#documentElement">documentElement</a>();
<a href="tqdomnode.html">TQDomNode</a> n = docElem.<a href="tqdomnode.html#firstChild">firstChild</a>();
while( !n.<a href="tqdomnode.html#isNull">isNull</a>() ) {
<a href="tqdomelement.html">TQDomElement</a> e = n.<a href="tqdomnode.html#toElement">toElement</a>(); // try to convert the node to an element.
if( !e.<a href="tqdomnode.html#isNull">isNull</a>() ) {
cout << e.<a href="tqdomelement.html#tagName">tagName</a>() << endl; // the node really is an element.
}
n = n.<a href="tqdomnode.html#nextSibling">nextSibling</a>();
}
// Here we append a new element to the end of the document
<a href="tqdomelement.html">TQDomElement</a> elem = doc.<a href="#createElement">createElement</a>( "img" );
elem.<a href="tqdomelement.html#setAttribute">setAttribute</a>( "src", "myimage.png" );
docElem.<a href="tqdomnode.html#appendChild">appendChild</a>( elem );
</pre>
<p> Once <tt>doc</tt> and <tt>elem</tt> go out of scope, the whole internal tree
representing the XML document is deleted.
<p> To create a document using DOM use code like this:
<pre>
TQDomDocument doc( "MyML" );
<a href="tqdomelement.html">TQDomElement</a> root = doc.<a href="#createElement">createElement</a>( "MyML" );
doc.<a href="tqdomnode.html#appendChild">appendChild</a>( root );
<a href="tqdomelement.html">TQDomElement</a> tag = doc.<a href="#createElement">createElement</a>( "Greeting" );
root.<a href="tqdomnode.html#appendChild">appendChild</a>( tag );
<a href="tqdomtext.html">TQDomText</a> t = doc.<a href="#createTextNode">createTextNode</a>( "Hello World" );
tag.<a href="tqdomnode.html#appendChild">appendChild</a>( t );
<a href="tqstring.html">TQString</a> xml = doc.<a href="#toString">toString</a>();
</pre>
<p> For further information about the Document Object Model see
<a href="http://www.w3.org/TR/REC-DOM-Level-1/">http://www.w3.org/TR/REC-DOM-Level-1/</a> and
<a href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</a>.
For a more general introduction of the DOM implementation see the
TQDomDocument documentation.
<p>See also <a href="xml-tools.html">XML</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDomDocument"></a>TQDomDocument::TQDomDocument ()
</h3>
Constructs an empty document.
<h3 class=fn>explicit <a name="TQDomDocument-2"></a>TQDomDocument::TQDomDocument ( const <a href="tqstring.html">TQString</a> & name )
</h3>
Creates a document and sets the name of the document type to <em>name</em>.
<h3 class=fn>explicit <a name="TQDomDocument-3"></a>TQDomDocument::TQDomDocument ( const <a href="tqdomdocumenttype.html">TQDomDocumentType</a> & doctype )
</h3>
Creates a document with the document type <em>doctype</em>.
<p> <p>See also <a href="tqdomimplementation.html#createDocumentType">TQDomImplementation::createDocumentType</a>().
<h3 class=fn><a name="TQDomDocument-4"></a>TQDomDocument::TQDomDocument ( const <a href="tqdomdocument.html">TQDomDocument</a> & x )
</h3>
Constructs a copy of <em>x</em>.
<p> The data of the copy is shared (shallow copy): modifying one node
will also change the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use
<a href="tqdomnode.html#cloneNode">cloneNode</a>().
<h3 class=fn><a name="~TQDomDocument"></a>TQDomDocument::~TQDomDocument ()
</h3>
Destroys the object and frees its resources.
<h3 class=fn><a href="tqdomattr.html">TQDomAttr</a> <a name="createAttribute"></a>TQDomDocument::createAttribute ( const <a href="tqstring.html">TQString</a> & name )
</h3>
Creates a new attribute called <em>name</em> that can be inserted into
an element, e.g. using <a href="tqdomelement.html#setAttributeNode">TQDomElement::setAttributeNode</a>().
<p> <p>See also <a href="#createAttributeNS">createAttributeNS</a>().
<h3 class=fn><a href="tqdomattr.html">TQDomAttr</a> <a name="createAttributeNS"></a>TQDomDocument::createAttributeNS ( const <a href="tqstring.html">TQString</a> & nsURI, const <a href="tqstring.html">TQString</a> & qName )
</h3>
Creates a new attribute with namespace support that can be
inserted into an element. The name of the attribute is <em>qName</em>
and the namespace URI is <em>nsURI</em>. This function also sets
<a href="tqdomnode.html#prefix">TQDomNode::prefix</a>() and <a href="tqdomnode.html#localName">TQDomNode::localName</a>() to appropriate values
(depending on <em>qName</em>).
<p> <p>See also <a href="#createAttribute">createAttribute</a>().
<h3 class=fn><a href="tqdomcdatasection.html">TQDomCDATASection</a> <a name="createCDATASection"></a>TQDomDocument::createCDATASection ( const <a href="tqstring.html">TQString</a> & value )
</h3>
Creates a new CDATA section for the string <em>value</em> that can be
inserted into the document, e.g. using <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>().
<p> <p>See also <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), and <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>().
<h3 class=fn><a href="tqdomcomment.html">TQDomComment</a> <a name="createComment"></a>TQDomDocument::createComment ( const <a href="tqstring.html">TQString</a> & value )
</h3>
Creates a new comment for the string <em>value</em> that can be inserted
into the document, e.g. using <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>().
<p> <p>See also <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), and <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>().
<h3 class=fn><a href="tqdomdocumentfragment.html">TQDomDocumentFragment</a> <a name="createDocumentFragment"></a>TQDomDocument::createDocumentFragment ()
</h3>
Creates a new document fragment, that can be used to hold parts of
the document, e.g. when doing complex manipulations of the
document tree.
<h3 class=fn><a href="tqdomelement.html">TQDomElement</a> <a name="createElement"></a>TQDomDocument::createElement ( const <a href="tqstring.html">TQString</a> & tagName )
</h3>
Creates a new element called <em>tagName</em> that can be inserted into
the DOM tree, e.g. using <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>().
<p> <p>See also <a href="#createElementNS">createElementNS</a>(), <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), and <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>().
<h3 class=fn><a href="tqdomelement.html">TQDomElement</a> <a name="createElementNS"></a>TQDomDocument::createElementNS ( const <a href="tqstring.html">TQString</a> & nsURI, const <a href="tqstring.html">TQString</a> & qName )
</h3>
Creates a new element with namespace support that can be inserted
into the DOM tree. The name of the element is <em>qName</em> and the
namespace URI is <em>nsURI</em>. This function also sets
<a href="tqdomnode.html#prefix">TQDomNode::prefix</a>() and <a href="tqdomnode.html#localName">TQDomNode::localName</a>() to appropriate values
(depending on <em>qName</em>).
<p> <p>See also <a href="#createElement">createElement</a>().
<h3 class=fn><a href="tqdomentityreference.html">TQDomEntityReference</a> <a name="createEntityReference"></a>TQDomDocument::createEntityReference ( const <a href="tqstring.html">TQString</a> & name )
</h3>
Creates a new entity reference called <em>name</em> that can be inserted
into the document, e.g. using <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>().
<p> <p>See also <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), and <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>().
<h3 class=fn><a href="tqdomprocessinginstruction.html">TQDomProcessingInstruction</a> <a name="createProcessingInstruction"></a>TQDomDocument::createProcessingInstruction ( const <a href="tqstring.html">TQString</a> & target, const <a href="tqstring.html">TQString</a> & data )
</h3>
Creates a new processing instruction that can be inserted into the
document, e.g. using <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(). This function sets
the target for the processing instruction to <em>target</em> and the
data to <em>data</em>.
<p> <p>See also <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), and <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>().
<h3 class=fn><a href="tqdomtext.html">TQDomText</a> <a name="createTextNode"></a>TQDomDocument::createTextNode ( const <a href="tqstring.html">TQString</a> & value )
</h3>
Creates a text node for the string <em>value</em> that can be inserted
into the document tree, e.g. using <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>().
<p> <b>Warning:</b> All characters within an XML document must be in the range:
<p> #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
<p> This rule also applies to characters encoded as character entities and
characters in CDATA sections. If you use this function to insert
characters outside of this range, the document will not be well-formed.
<p> If you want to store binary data in an XML document you must either use
your own scheme to escape illegal characters, or you must store it in
an external unparsed entity.
<p> <p>See also <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), and <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>().
<h3 class=fn><a href="tqdomdocumenttype.html">TQDomDocumentType</a> <a name="doctype"></a>TQDomDocument::doctype () const
</h3>
Returns the document type of this document.
<h3 class=fn><a href="tqdomelement.html">TQDomElement</a> <a name="documentElement"></a>TQDomDocument::documentElement () const
</h3>
Returns the root element of the document.
<h3 class=fn><a href="tqdomelement.html">TQDomElement</a> <a name="elementById"></a>TQDomDocument::elementById ( const <a href="tqstring.html">TQString</a> & elementId )
</h3>
Returns the element whose ID is equal to <em>elementId</em>. If no
element with the ID was found, this function returns a <a href="tqdomnode.html#isNull">null element</a>.
<p> Since the TQDomClasses do not know which attributes are element
IDs, this function returns always a <a href="tqdomnode.html#isNull">null
element</a>. This may change in a future version.
<h3 class=fn><a href="tqdomnodelist.html">TQDomNodeList</a> <a name="elementsByTagName"></a>TQDomDocument::elementsByTagName ( const <a href="tqstring.html">TQString</a> & tagname ) const
</h3>
Returns a <a href="tqdomnodelist.html">TQDomNodeList</a>, that contains all the elements in the
document with the name <em>tagname</em>. The order of the node list is
the order they are encountered in a preorder traversal of the
element tree.
<p> <p>See also <a href="#elementsByTagNameNS">elementsByTagNameNS</a>() and <a href="tqdomelement.html#elementsByTagName">TQDomElement::elementsByTagName</a>().
<h3 class=fn><a href="tqdomnodelist.html">TQDomNodeList</a> <a name="elementsByTagNameNS"></a>TQDomDocument::elementsByTagNameNS ( const <a href="tqstring.html">TQString</a> & nsURI, const <a href="tqstring.html">TQString</a> & localName )
</h3>
Returns a <a href="tqdomnodelist.html">TQDomNodeList</a> that contains all the elements in the
document with the local name <em>localName</em> and a namespace URI of
<em>nsURI</em>. The order of the node list is the order they are
encountered in a preorder traversal of the element tree.
<p> <p>See also <a href="#elementsByTagName">elementsByTagName</a>() and <a href="tqdomelement.html#elementsByTagNameNS">TQDomElement::elementsByTagNameNS</a>().
<h3 class=fn><a href="tqdomimplementation.html">TQDomImplementation</a> <a name="implementation"></a>TQDomDocument::implementation () const
</h3>
Returns a <a href="tqdomimplementation.html">TQDomImplementation</a> object.
<h3 class=fn><a href="tqdomnode.html">TQDomNode</a> <a name="importNode"></a>TQDomDocument::importNode ( const <a href="tqdomnode.html">TQDomNode</a> & importedNode, bool deep )
</h3>
Imports the node <em>importedNode</em> from another document to this
document. <em>importedNode</em> remains in the original document; this
function creates a copy that can be used within this document.
<p> This function returns the imported node that belongs to this
document. The returned node has no parent. It is not possible to
import TQDomDocument and <a href="tqdomdocumenttype.html">TQDomDocumentType</a> nodes. In those cases
this function returns a <a href="tqdomnode.html#isNull">null node</a>.
<p> If <em>deep</em> is TRUE, this function imports not only the node <em>importedNode</em> but its whole subtree; if it is FALSE, only the <em>importedNode</em> is imported. The argument <em>deep</em> has no effect on
<a href="tqdomattr.html">TQDomAttr</a> and <a href="tqdomentityreference.html">TQDomEntityReference</a> nodes, since the descendents of
TQDomAttr nodes are always imported and those of
TQDomEntityReference nodes are never imported.
<p> The behavior of this function is slightly different depending on
the node types:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Node Type <th valign="top">Behaviour
<tr bgcolor="#f0f0f0"> <td valign="top">TQDomAttr
<td valign="top">The owner element is set to 0 and the specified flag is
set to TRUE in the generated attribute. The whole subtree
of <em>importedNode</em> is always imported for attribute nodes:
<em>deep</em> has no effect.
<tr bgcolor="#d0d0d0"> <td valign="top">TQDomDocument
<td valign="top">Document nodes cannot be imported.
<tr bgcolor="#f0f0f0"> <td valign="top">TQDomDocumentFragment
<td valign="top">If <em>deep</em> is TRUE, this function imports the whole
document fragment; otherwise it only generates an empty
document fragment.
<tr bgcolor="#d0d0d0"> <td valign="top">TQDomDocumentType
<td valign="top">Document type nodes cannot be imported.
<tr bgcolor="#f0f0f0"> <td valign="top">TQDomElement
<td valign="top">Attributes for which <a href="tqdomattr.html#specified">TQDomAttr::specified</a>() is TRUE are
also imported, other attributes are not imported. If <em>deep</em> is TRUE, this function also imports the subtree of <em>importedNode</em>; otherwise it imports only the element node
(and some attributes, see above).
<tr bgcolor="#d0d0d0"> <td valign="top">TQDomEntity
<td valign="top">Entity nodes can be imported, but at the moment there is
no way to use them since the document type is read-only in
DOM level 2.
<tr bgcolor="#f0f0f0"> <td valign="top">TQDomEntityReference
<td valign="top">Descendents of entity reference nodes are never imported:
<em>deep</em> has no effect.
<tr bgcolor="#d0d0d0"> <td valign="top">TQDomNotation
<td valign="top">Notation nodes can be imported, but at the moment there is
no way to use them since the document type is read-only in
DOM level 2.
<tr bgcolor="#f0f0f0"> <td valign="top">TQDomProcessingInstruction
<td valign="top">The target and value of the processing instruction is
copied to the new node.
<tr bgcolor="#d0d0d0"> <td valign="top">TQDomText
<td valign="top">The text is copied to the new node.
<tr bgcolor="#f0f0f0"> <td valign="top">TQDomCDATASection
<td valign="top">The text is copied to the new node.
<tr bgcolor="#d0d0d0"> <td valign="top">TQDomComment
<td valign="top">The text is copied to the new node.
</table></center>
<p> <p>See also <a href="tqdomelement.html#setAttribute">TQDomElement::setAttribute</a>(), <a href="tqdomnode.html#insertBefore">TQDomNode::insertBefore</a>(), <a href="tqdomnode.html#insertAfter">TQDomNode::insertAfter</a>(), <a href="tqdomnode.html#replaceChild">TQDomNode::replaceChild</a>(), <a href="tqdomnode.html#removeChild">TQDomNode::removeChild</a>(), and <a href="tqdomnode.html#appendChild">TQDomNode::appendChild</a>().
<h3 class=fn>bool <a name="isDocument"></a>TQDomDocument::isDocument () const<tt> [virtual]</tt>
</h3>
Returns TRUE.
<p>Reimplemented from <a href="tqdomnode.html#isDocument">TQDomNode</a>.
<h3 class=fn><a href="tqdomnode.html#NodeType-enum">TQDomNode::NodeType</a> <a name="nodeType"></a>TQDomDocument::nodeType () const<tt> [virtual]</tt>
</h3>
Returns <a href="tqdomnode.html#NodeType-enum">DocumentNode</a>.
<p>Reimplemented from <a href="tqdomnode.html#nodeType">TQDomNode</a>.
<h3 class=fn><a href="tqdomdocument.html">TQDomDocument</a> & <a name="operator-eq"></a>TQDomDocument::operator= ( const <a href="tqdomdocument.html">TQDomDocument</a> & x )
</h3>
Assigns <em>x</em> to this DOM document.
<p> The data of the copy is shared (shallow copy): modifying one node
will also change the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use
<a href="tqdomnode.html#cloneNode">cloneNode</a>().
<h3 class=fn>bool <a name="setContent"></a>TQDomDocument::setContent ( const <a href="qbytearray.html">TQByteArray</a> & buffer, bool namespaceProcessing, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This function parses the XML document from the byte array <em>buffer</em> and sets it as the content of the document. It tries to
detect the encoding of the document as required by the XML
specification.
<p> If <em>namespaceProcessing</em> is TRUE, the parser recognizes
namespaces in the XML file and sets the prefix name, local name
and namespace URI to appropriate values. If <em>namespaceProcessing</em>
is FALSE, the parser does no namespace processing when it reads
the XML file.
<p> If a parse error occurs, the function returns FALSE; otherwise it
returns TRUE. If a parse error occurs and <em>errorMsg</em>, <em>errorLine</em> and <em>errorColumn</em> are not 0, the error message is
placed in <em>*errorMsg</em>, the line number <em>*errorLine</em> and the
column number in <em>*errorColumn</em>.
<p> If <em>namespaceProcessing</em> is TRUE, the function <a href="tqdomnode.html#prefix">TQDomNode::prefix</a>()
returns a string for all elements and attributes. It returns an
empty string if the element or attribute has no prefix.
<p> If <em>namespaceProcessing</em> is FALSE, the functions
TQDomNode::prefix(), <a href="tqdomnode.html#localName">TQDomNode::localName</a>() and
<a href="tqdomnode.html#namespaceURI">TQDomNode::namespaceURI</a>() return <a href="tqstring.html#TQString-null">TQString::null</a>.
<p> <p>See also <a href="tqdomnode.html#namespaceURI">TQDomNode::namespaceURI</a>(), <a href="tqdomnode.html#localName">TQDomNode::localName</a>(), <a href="tqdomnode.html#prefix">TQDomNode::prefix</a>(), <a href="tqstring.html#isNull">TQString::isNull</a>(), and <a href="tqstring.html#isEmpty">TQString::isEmpty</a>().
<h3 class=fn>bool <a name="setContent-2"></a>TQDomDocument::setContent ( const <a href="ntqcstring.html">TQCString</a> & buffer, bool namespaceProcessing, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the C string <em>buffer</em>.
<p> <b>Warning:</b> This function does not try to detect the encoding:
instead it assumes that the C string is UTF-8 encoded.
<h3 class=fn>bool <a name="setContent-3"></a>TQDomDocument::setContent ( const <a href="tqstring.html">TQString</a> & text, bool namespaceProcessing, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the string <em>text</em>.
Since <em>text</em> is already a Unicode string, no encoding detection
is done.
<h3 class=fn>bool <a name="setContent-4"></a>TQDomDocument::setContent ( <a href="ntqiodevice.html">TQIODevice</a> * dev, bool namespaceProcessing, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the IO device <em>dev</em>.
<h3 class=fn>bool <a name="setContent-5"></a>TQDomDocument::setContent ( const <a href="ntqcstring.html">TQCString</a> & buffer, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the C string <em>buffer</em>.
<p> No namespace processing is performed.
<p> <b>Warning:</b> This function does not try to detect the encoding:
instead it assumes that the C string is UTF-8 encoded.
<h3 class=fn>bool <a name="setContent-6"></a>TQDomDocument::setContent ( const <a href="qbytearray.html">TQByteArray</a> & buffer, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the byte array <em>buffer</em>.
<p> No namespace processing is performed.
<h3 class=fn>bool <a name="setContent-7"></a>TQDomDocument::setContent ( const <a href="tqstring.html">TQString</a> & text, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the string <em>text</em>.
Since <em>text</em> is already a Unicode string, no encoding detection
is performed.
<p> No namespace processing is performed either.
<h3 class=fn>bool <a name="setContent-8"></a>TQDomDocument::setContent ( <a href="ntqiodevice.html">TQIODevice</a> * dev, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the IO device <em>dev</em>.
<p> No namespace processing is performed.
<h3 class=fn>bool <a name="setContent-9"></a>TQDomDocument::setContent ( <a href="tqxmlinputsource.html">TQXmlInputSource</a> * source, <a href="tqxmlreader.html">TQXmlReader</a> * reader, <a href="tqstring.html">TQString</a> * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function reads the XML document from the <a href="tqxmlinputsource.html">TQXmlInputSource</a> <em>source</em> and
parses it with the <a href="tqxmlreader.html">TQXmlReader</a> <em>reader</em>.
<p> This function doesn't change the features of the <em>reader</em>. If you want to
use certain features for parsing you can use this function to set up the
reader appropriate.
<p> <p>See also <a href="tqxmlsimplereader.html">TQXmlSimpleReader</a>.
<h3 class=fn><a href="ntqcstring.html">TQCString</a> <a name="toCString"></a>TQDomDocument::toCString () const
</h3>
Converts the parsed document back to its textual representation
and returns a <a href="ntqcstring.html">TQCString</a> for that is encoded in UTF-8.
<p> <p>See also <a href="#toString">toString</a>().
<h3 class=fn><a href="ntqcstring.html">TQCString</a> <a name="toCString-2"></a>TQDomDocument::toCString ( int indent ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function uses <em>indent</em> as the amount of space to indent
subelements.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="toString"></a>TQDomDocument::toString () const
</h3>
Converts the parsed document back to its textual representation.
<p> <p>See also <a href="#toCString">toCString</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="toString-2"></a>TQDomDocument::toString ( int indent ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function uses <em>indent</em> as the amount of space to indent
subelements.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>
|