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 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753
|
'\" t
.TH QDomNode 3qt "18 March 2002" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QDomNode \- The base class for all the nodes in a DOM tree
.SH SYNOPSIS
\fC#include <qdom.h>\fR
.PP
Inherited by QDomDocumentType, QDomDocument, QDomDocumentFragment, QDomCharacterData, QDomAttr, QDomElement, QDomNotation, QDomEntity, QDomEntityReference and QDomProcessingInstruction.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBNodeType\fR { ElementNode = 1, AttributeNode = 2, TextNode = 3, CDATASectionNode = 4, EntityReferenceNode = 5, EntityNode = 6, ProcessingInstructionNode = 7, CommentNode = 8, DocumentNode = 9, DocumentTypeNode = 10, DocumentFragmentNode = 11, NotationNode = 12, BaseNode = 21, CharacterDataNode = 22 }"
.br
.ti -1c
.BI "\fBQDomNode\fR ()"
.br
.ti -1c
.BI "\fBQDomNode\fR ( const QDomNode & n )"
.br
.ti -1c
.BI "QDomNode & \fBoperator=\fR ( const QDomNode & n )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const QDomNode & n ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QDomNode & n ) const"
.br
.ti -1c
.BI "virtual \fB~QDomNode\fR ()"
.br
.ti -1c
.BI "virtual QDomNode \fBinsertBefore\fR ( const QDomNode & newChild, const QDomNode & refChild )"
.br
.ti -1c
.BI "virtual QDomNode \fBinsertAfter\fR ( const QDomNode & newChild, const QDomNode & refChild )"
.br
.ti -1c
.BI "virtual QDomNode \fBreplaceChild\fR ( const QDomNode & newChild, const QDomNode & oldChild )"
.br
.ti -1c
.BI "virtual QDomNode \fBremoveChild\fR ( const QDomNode & oldChild )"
.br
.ti -1c
.BI "virtual QDomNode \fBappendChild\fR ( const QDomNode & newChild )"
.br
.ti -1c
.BI "virtual bool \fBhasChildNodes\fR () const"
.br
.ti -1c
.BI "virtual QDomNode \fBcloneNode\fR ( bool deep = TRUE ) const"
.br
.ti -1c
.BI "virtual void \fBnormalize\fR ()"
.br
.ti -1c
.BI "virtual bool \fBisSupported\fR ( const QString & feature, const QString & version ) const"
.br
.ti -1c
.BI "virtual QString \fBnodeName\fR () const"
.br
.ti -1c
.BI "virtual QDomNode::NodeType \fBnodeType\fR () const"
.br
.ti -1c
.BI "virtual QDomNode \fBparentNode\fR () const"
.br
.ti -1c
.BI "virtual QDomNodeList \fBchildNodes\fR () const"
.br
.ti -1c
.BI "virtual QDomNode \fBfirstChild\fR () const"
.br
.ti -1c
.BI "virtual QDomNode \fBlastChild\fR () const"
.br
.ti -1c
.BI "virtual QDomNode \fBpreviousSibling\fR () const"
.br
.ti -1c
.BI "virtual QDomNode \fBnextSibling\fR () const"
.br
.ti -1c
.BI "virtual QDomNamedNodeMap \fBattributes\fR () const"
.br
.ti -1c
.BI "virtual QDomDocument \fBownerDocument\fR () const"
.br
.ti -1c
.BI "virtual QString \fBnamespaceURI\fR () const"
.br
.ti -1c
.BI "virtual QString \fBlocalName\fR () const"
.br
.ti -1c
.BI "virtual bool \fBhasAttributes\fR () const"
.br
.ti -1c
.BI "virtual QString \fBnodeValue\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetNodeValue\fR ( const QString & v )"
.br
.ti -1c
.BI "virtual QString \fBprefix\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetPrefix\fR ( const QString & pre )"
.br
.ti -1c
.BI "virtual bool \fBisAttr\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisCDATASection\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisDocumentFragment\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisDocument\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisDocumentType\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisElement\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisEntityReference\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisText\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisEntity\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisNotation\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisProcessingInstruction\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisCharacterData\fR () const"
.br
.ti -1c
.BI "virtual bool \fBisComment\fR () const"
.br
.ti -1c
.BI "QDomNode \fBnamedItem\fR ( const QString & name ) const"
.br
.ti -1c
.BI "bool \fBisNull\fR () const"
.br
.ti -1c
.BI "void \fBclear\fR ()"
.br
.ti -1c
.BI "QDomAttr \fBtoAttr\fR ()"
.br
.ti -1c
.BI "QDomCDATASection \fBtoCDATASection\fR ()"
.br
.ti -1c
.BI "QDomDocumentFragment \fBtoDocumentFragment\fR ()"
.br
.ti -1c
.BI "QDomDocument \fBtoDocument\fR ()"
.br
.ti -1c
.BI "QDomDocumentType \fBtoDocumentType\fR ()"
.br
.ti -1c
.BI "QDomElement \fBtoElement\fR ()"
.br
.ti -1c
.BI "QDomEntityReference \fBtoEntityReference\fR ()"
.br
.ti -1c
.BI "QDomText \fBtoText\fR ()"
.br
.ti -1c
.BI "QDomEntity \fBtoEntity\fR ()"
.br
.ti -1c
.BI "QDomNotation \fBtoNotation\fR ()"
.br
.ti -1c
.BI "QDomProcessingInstruction \fBtoProcessingInstruction\fR ()"
.br
.ti -1c
.BI "QDomCharacterData \fBtoCharacterData\fR ()"
.br
.ti -1c
.BI "QDomComment \fBtoComment\fR ()"
.br
.ti -1c
.BI "void \fBsave\fR ( QTextStream & str, int indent ) const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "QTextStream & \fBoperator<<\fR ( QTextStream & str, const QDomNode & node )"
.br
.in -1c
.SH DESCRIPTION
The QDomNode class is the base class for all the nodes in a DOM tree.
.PP
Many functions in the DOM return a QDomNode.
.PP
You can find out the type of a node using isAttr(), isCDATASection(), isDocumentFragment(), isDocument(), isDocumentType(), isElement(), isEntityReference(), isText(), isEntity(), isNotation(), isProcessingInstruction(), isCharacterData() and isComment().
.PP
A QDomNode can be converted into one of its subclasses using toAttr(), toCDATASection(), toDocumentFragment(), toDocument(), toDocumentType(), toElement(), toEntityReference(), toText(), toEntity(), toNotation(), toProcessingInstruction(), toCharacterData() or toComment(). You can convert a node to a null node with clear().
.PP
Copies of the QDomNode class share their data; this means modifying one node will change all copies. This is especially useful in combination with functions which return a QDomNode, e.g. firstChild(). You can make an independent (deep) copy of the node with cloneNode().
.PP
Nodes are inserted with insertBefore(), insertAfter() or appendChild(). You can replace one node with another using replaceChild() and remove a node with removeChild().
.PP
To traverse nodes use firstChild() to get a node's first child (if any), and nextSibling() to traverse. QDomNode also provides lastChild(), previousSibling() and parentNode(). To find the first child node with a particular node name use namedItem().
.PP
To find out if a node has children use hasChildNodes() and to get a list of all of a node's children use childNodes().
.PP
The node's name and value (the meaning of which varies depending on its type) is returned by nodeName() and nodeValue() respectively. The node's type is returned by nodeType(). The node's value can be set with setNodeValue().
.PP
The document to which the node belongs is returned by ownerDocument().
.PP
Adjacent QDomText nodes can be merged into a single node with normalize().
.PP
QDomElement nodes have attributes which can be retrieved with attributes().
.PP
QDomElement and QDomAttr nodes can have namespaces which can be retrieved with namespaceURI(). Their local name is retrieved with localName(), and their prefix with prefix(). The prefix can be set with setPrefix().
.PP
You can write the XML representation of the node to a text stream with save().
.PP
The following example looks for the first element in an XML document and prints the names of all the elements that are its direct children.
.PP
.nf
.br
QDomDocument d;
.br
d.setContent( someXML );
.br
QDomNode n = d.firstChild();
.br
while ( !n.isNull() ) {
.br
if ( n.isElement() ) {
.br
QDomElement e = n.toElement();
.br
cout << "Element name: " << e.tagName() << endl;
.br
return;
.br
}
.br
n = n.nextSibling();
.br
}
.br
.fi
.PP
For further information about the Document Object Model see http://www.w3.org/TR/REC-DOM-Level-1/ and http://www.w3.org/TR/DOM-Level-2-Core/. For a more general introduction of the DOM implementation see the QDomDocument documentation.
.PP
See also XML.
.SS "Member Type Documentation"
.SH "QDomNode::NodeType"
This enum defines the type of the node:
.TP
\fCQDomNode::ElementNode\fR
.TP
\fCQDomNode::AttributeNode\fR
.TP
\fCQDomNode::TextNode\fR
.TP
\fCQDomNode::CDATASectionNode\fR
.TP
\fCQDomNode::EntityReferenceNode\fR
.TP
\fCQDomNode::EntityNode\fR
.TP
\fCQDomNode::ProcessingInstructionNode\fR
.TP
\fCQDomNode::CommentNode\fR
.TP
\fCQDomNode::DocumentNode\fR
.TP
\fCQDomNode::DocumentTypeNode\fR
.TP
\fCQDomNode::DocumentFragmentNode\fR
.TP
\fCQDomNode::NotationNode\fR
.TP
\fCQDomNode::BaseNode\fR - A QDomNode object, i.e. not a QDomNode subclass.
.TP
\fCQDomNode::CharacterDataNode\fR
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QDomNode::QDomNode ()"
Constructs an empty node.
.SH "QDomNode::QDomNode ( const QDomNode & n )"
Constructs a copy of \fIn\fR.
.PP
The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode().
.SH "QDomNode::~QDomNode ()\fC [virtual]\fR"
Destroys the object and frees its resources.
.SH "QDomNode QDomNode::appendChild ( const QDomNode & newChild )\fC [virtual]\fR"
Appends \fInewChild\fR as the node's last child.
.PP
If \fInewChild\fR is the child of another node, it is reparented to this node. If \fInewChild\fR is a child of this node, then its position in the list of children is changed.
.PP
Returns a new reference to \fInewChild\fR.
.PP
See also insertBefore(), insertAfter(), replaceChild() and removeChild().
.SH "QDomNamedNodeMap QDomNode::attributes () const\fC [virtual]\fR"
Returns a named node map of all attributes. Attributes are only provided for QDomElement.
.PP
Changing the attributes in the map will also change the attributes of this QDomNode.
.PP
Reimplemented in QDomElement.
.SH "QDomNodeList QDomNode::childNodes () const\fC [virtual]\fR"
Returns a list of all direct child nodes.
.PP
Most often you will call this function on a QDomElement object.
.PP
For example, if the XML document looks like this:
.PP
.nf
.br
<body>
.br
<h1>Heading</h1>
.br
<p>Hello <b>you</b></p>
.br
</body>
.br
.fi
Then the list of child nodes for the "body"-element will contain the node created by the <h1> tag and the node created by the <p> tag.
.PP
The nodes in the list are not copied; so changing the nodes in the list will also change the children of this node.
.PP
See also firstChild() and lastChild().
.SH "void QDomNode::clear ()"
Dereferences the internal object. The node becomes a null node.
.PP
See also isNull().
.SH "QDomNode QDomNode::cloneNode ( bool deep = TRUE ) const\fC [virtual]\fR"
Creates a real (not shallow) copy of the QDomNode.
.PP
If \fIdeep\fR is TRUE, then the cloning is done recursively which means that all the node's children are copied, too. If \fIdeep\fR is FALSE only the node itself is copied and the copy will have no child nodes.
.SH "QDomNode QDomNode::firstChild () const\fC [virtual]\fR"
Returns the first child of the node. If there is no child node, a null node is returned. Changing the returned node will also change the node in the document tree.
.PP
See also lastChild() and childNodes().
.PP
Example: xml/outliner/outlinetree.cpp.
.SH "bool QDomNode::hasAttributes () const\fC [virtual]\fR"
Returns TRUE if the node has attributes; otherwise returns FALSE.
.PP
See also attributes().
.SH "bool QDomNode::hasChildNodes () const\fC [virtual]\fR"
Returns TRUE if the node has one or more children; otherwise returns FALSE.
.SH "QDomNode QDomNode::insertAfter ( const QDomNode & newChild, const QDomNode & refChild )\fC [virtual]\fR"
Inserts the node \fInewChild\fR after the child node \fIrefChild\fR. \fIrefChild\fR must be a direct child of this node. If \fIrefChild\fR is null then \fInewChild\fR is appended as this node's last child.
.PP
If \fInewChild\fR is the child of another node, it is reparented to this node. If \fInewChild\fR is a child of this node, then its position in the list of children is changed.
.PP
If \fInewChild\fR is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and inserted after \fIrefChild\fR.
.PP
Returns a new reference to \fInewChild\fR on success or an empty node on failure.
.PP
See also insertBefore(), replaceChild(), removeChild() and appendChild().
.SH "QDomNode QDomNode::insertBefore ( const QDomNode & newChild, const QDomNode & refChild )\fC [virtual]\fR"
Inserts the node \fInewChild\fR before the child node \fIrefChild\fR. \fIrefChild\fR must be a direct child of this node. If \fIrefChild\fR is null then \fInewChild\fR is inserted as the node's first child.
.PP
If \fInewChild\fR is the child of another node, it is reparented to this node. If \fInewChild\fR is a child of this node, then its position in the list of children is changed.
.PP
If \fInewChild\fR is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and inserted before \fIrefChild\fR.
.PP
Returns a new reference to \fInewChild\fR on success or an empty node on failure.
.PP
See also insertAfter(), replaceChild(), removeChild() and appendChild().
.SH "bool QDomNode::isAttr () const\fC [virtual]\fR"
Returns TRUE if the node is an attribute; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomAttribute; you can get the QDomAttribute with toAttribute().
.PP
See also toAttr().
.PP
Reimplemented in QDomAttr.
.SH "bool QDomNode::isCDATASection () const\fC [virtual]\fR"
Returns TRUE if the node is a CDATA section; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomCDATASection; you can get the QDomCDATASection with toCDATASection().
.PP
See also toCDATASection().
.PP
Reimplemented in QDomCDATASection.
.SH "bool QDomNode::isCharacterData () const\fC [virtual]\fR"
Returns TRUE if the node is a character data node; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomCharacterData; you can get the QDomCharacterData with toCharacterData().
.PP
See also toCharacterData().
.PP
Reimplemented in QDomCharacterData.
.SH "bool QDomNode::isComment () const\fC [virtual]\fR"
Returns TRUE if the node is a comment; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomComment; you can get the QDomComment with toComment().
.PP
See also toComment().
.PP
Reimplemented in QDomComment.
.SH "bool QDomNode::isDocument () const\fC [virtual]\fR"
Returns TRUE if the node is a document; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomDocument; you can get the QDomDocument with toDocument().
.PP
See also toDocument().
.PP
Reimplemented in QDomDocument.
.SH "bool QDomNode::isDocumentFragment () const\fC [virtual]\fR"
Returns TRUE if the node is a document fragment; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomDocumentFragment; you can get the QDomDocumentFragment with toDocumentFragment().
.PP
See also toDocumentFragment().
.PP
Reimplemented in QDomDocumentFragment.
.SH "bool QDomNode::isDocumentType () const\fC [virtual]\fR"
Returns TRUE if the node is a document type; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomDocumentType; you can get the QDomDocumentType with toDocumentType().
.PP
See also toDocumentType().
.PP
Reimplemented in QDomDocumentType.
.SH "bool QDomNode::isElement () const\fC [virtual]\fR"
Returns TRUE if the node is an element; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomElement; you can get the QDomElement with toElement().
.PP
See also toElement().
.PP
Example: xml/outliner/outlinetree.cpp.
.PP
Reimplemented in QDomElement.
.SH "bool QDomNode::isEntity () const\fC [virtual]\fR"
Returns TRUE if the node is an entity; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomEntity; you can get the QDomEntity with toEntity().
.PP
See also toEntity().
.PP
Reimplemented in QDomEntity.
.SH "bool QDomNode::isEntityReference () const\fC [virtual]\fR"
Returns TRUE if the node is an entity reference; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomEntityReference; you can get the QDomEntityReference with toEntityReference().
.PP
See also toEntityReference().
.PP
Reimplemented in QDomEntityReference.
.SH "bool QDomNode::isNotation () const\fC [virtual]\fR"
Returns TRUE if the node is a notation; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomNotation; you can get the QDomNotation with toNotation().
.PP
See also toNotation().
.PP
Reimplemented in QDomNotation.
.SH "bool QDomNode::isNull () const"
Returns TRUE if this node does not reference any internal object; otherwise returns FALSE.
.PP
Example: xml/outliner/outlinetree.cpp.
.SH "bool QDomNode::isProcessingInstruction () const\fC [virtual]\fR"
Returns TRUE if the node is a processing instruction; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomProcessingInstruction; you can get the QProcessingInstruction with toProcessingInstruction().
.PP
See also toProcessingInstruction().
.PP
Reimplemented in QDomProcessingInstruction.
.SH "bool QDomNode::isSupported ( const QString & feature, const QString & version ) const\fC [virtual]\fR"
Returns TRUE if the DOM implementation implements the feature \fIfeature\fR and that feature is supported by this node in the version \fIversion\fR. Otherwise this function returns FALSE.
.PP
See also QDomImplementation::hasFeature().
.SH "bool QDomNode::isText () const\fC [virtual]\fR"
Returns TRUE if the node is a text; otherwise returns FALSE.
.PP
If this function returns TRUE, it does not imply that this object is a QDomText; you can get the QDomText with toText().
.PP
See also toText().
.PP
Reimplemented in QDomText.
.SH "QDomNode QDomNode::lastChild () const\fC [virtual]\fR"
Returns the last child of the node. If there is no child node, a null node is returned. Changing the returned node will also change the node in the document tree.
.PP
See also firstChild() and childNodes().
.SH "QString QDomNode::localName () const\fC [virtual]\fR"
If the node uses namespaces, this function returns the local name of the node. Otherwise it returns QString::null.
.PP
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace must have been specified at creation time; it is not possible to add a namespace afterwards.
.PP
See also prefix(), namespaceURI(), QDomDocument::createElementNS() and QDomDocument::createAttributeNS().
.SH "QDomNode QDomNode::namedItem ( const QString & name ) const"
Returns the first direct child node for which nodeName() equals \fIname\fR.
.PP
If no such direct child exists, a null node is returned.
.PP
See also nodeName().
.SH "QString QDomNode::namespaceURI () const\fC [virtual]\fR"
Returns the namespace URI of this node; if the node has no namespace URI, this function returns QString::null.
.PP
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace URI must be specified at creation time and cannot be changed later.
.PP
See also prefix(), localName(), QDomDocument::createElementNS() and QDomDocument::createAttributeNS().
.SH "QDomNode QDomNode::nextSibling () const\fC [virtual]\fR"
Returns the next sibling in the document tree. Changing the returned node will also change the node in the document tree.
.PP
If you have XML like this:
.PP
.nf
.br
<h1>Heading</h1>
.br
<p>The text...</p>
.br
<h2>Next heading</h2>
.br
.fi
and this QDomNode represents the <p> tag, nextSibling() will return the node representing the <h2> tag.
.PP
See also previousSibling().
.PP
Example: xml/outliner/outlinetree.cpp.
.SH "QString QDomNode::nodeName () const\fC [virtual]\fR"
Returns the name of the node.
.PP
The meaning of the name depends on the subclass:
.TP
QDomAttr - the name of the attribute
.TP
QDomCDATASection - the string "#cdata-section"
.TP
QDomComment - the string "#comment"
.TP
QDomDocument - the string "#document"
.TP
QDomDocumentFragment - the string "#document-fragment"
.TP
QDomDocumentType - the name of the document type
.TP
QDomElement - the tag name
.TP
QDomEntity - the name of the entity
.TP
QDomEntityReference - the name of the referenced entity
.TP
QDomNotation - the name of the notation
.TP
QDomProcessingInstruction - the target of the processing instruction
.TP
QDomText - the string "#text"
.PP
See also nodeValue().
.PP
Example: xml/outliner/outlinetree.cpp.
.SH "QDomNode::NodeType QDomNode::nodeType () const\fC [virtual]\fR"
Returns the type of the node.
.PP
See also toAttr(), toCDATASection(), toDocumentFragment(), toDocument(), toDocumentType(), toElement(), toEntityReference(), toText(), toEntity(), toNotation(), toProcessingInstruction(), toCharacterData() and toComment().
.PP
Reimplemented in QDomDocumentType, QDomDocument, QDomDocumentFragment, QDomCharacterData, QDomAttr, QDomElement, QDomNotation, QDomEntity, QDomEntityReference and QDomProcessingInstruction.
.SH "QString QDomNode::nodeValue () const\fC [virtual]\fR"
Returns the value of the node.
.PP
The meaning of the value depends on the subclass:
.TP
QDomAttr - the attribute value
.TP
QDomCDATASection - the content of the CDATA section
.TP
QDomComment - the comment
.TP
QDomProcessingInstruction - the data of the processing intruction
.TP
QDomText - the text
.PP
All other subclasses do not have a node value and will return a null string.
.PP
See also setNodeValue() and nodeName().
.PP
Example: xml/outliner/outlinetree.cpp.
.SH "void QDomNode::normalize ()\fC [virtual]\fR"
Calling normalize() on an element converts all its children into a standard form. This means, that adjacent QDomText objects will be merged into a single text object (QDomCDATASection nodes are not merged).
.SH "bool QDomNode::operator!= ( const QDomNode & n ) const"
Returns TRUE if \fIn\fR and this DOM node are not equal; otherwise returns FALSE.
.SH "QDomNode & QDomNode::operator= ( const QDomNode & n )"
Assigns a copy of \fIn\fR to this DOM node.
.PP
The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode().
.SH "bool QDomNode::operator== ( const QDomNode & n ) const"
Returns TRUE if \fIn\fR and this DOM node are equal; otherwise returns FALSE.
.SH "QDomDocument QDomNode::ownerDocument () const\fC [virtual]\fR"
Returns the document to which this node belongs.
.SH "QDomNode QDomNode::parentNode () const\fC [virtual]\fR"
Returns the parent node. If this node has no parent, a null node is returned (i.e. a node for which isNull() returns TRUE).
.SH "QString QDomNode::prefix () const\fC [virtual]\fR"
Returns the namespace prefix of the node; if a node has no namespace prefix, this function returns QString::null.
.PP
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace prefix must be specified at creation time. If a node was created with a namespace prefix, you can change it later with setPrefix().
.PP
If you create an element or attribute with QDomDocument::createElement() or QDomDocument::createAttribute(), the prefix will be null. If you use QDomDocument::createElementNS() or QDomDocument::createAttributeNS() instead, the prefix will not be null - although it might be an empty string if the name does not have a prefix.
.PP
See also setPrefix(), localName(), namespaceURI(), QDomDocument::createElementNS() and QDomDocument::createAttributeNS().
.SH "QDomNode QDomNode::previousSibling () const\fC [virtual]\fR"
Returns the previous sibling in the document tree. Changing the returned node will also change the node in the document tree.
.PP
For example, if you have XML like this:
.PP
.nf
.br
<h1>Heading</h1>
.br
<p>The text...</p>
.br
<h2>Next heading</h2>
.br
.fi
and this QDomNode represents the <p> tag, previousSibling() will return the node representing the <h1> tag.
.PP
See also nextSibling().
.SH "QDomNode QDomNode::removeChild ( const QDomNode & oldChild )\fC [virtual]\fR"
Removes \fIoldChild\fR from the list of children. \fIoldChild\fR must be a direct child of this node.
.PP
Returns a new reference to \fIoldChild\fR on success or a null node on failure.
.PP
See also insertBefore(), insertAfter(), replaceChild() and appendChild().
.SH "QDomNode QDomNode::replaceChild ( const QDomNode & newChild, const QDomNode & oldChild )\fC [virtual]\fR"
Replaces \fIoldChild\fR with \fInewChild\fR. \fIoldChild\fR must be a direct child of this node.
.PP
If \fInewChild\fR is the child of another node, it is reparented to this node. If \fInewChild\fR is a child of this node, then its position in the list of children is changed.
.PP
If \fInewChild\fR is a QDomDocumentFragment, then \fIoldChild\fR is replaced by all of the children of the fragment.
.PP
Returns a new reference to \fIoldChild\fR on success or a null node an failure.
.PP
See also insertBefore(), insertAfter(), removeChild() and appendChild().
.SH "void QDomNode::save ( QTextStream & str, int indent ) const"
Writes the XML representation of the node and all its children to the stream \fIstr\fR. This function uses \fIindent\fR as the amount of space to indent the node.
.SH "void QDomNode::setNodeValue ( const QString & v )\fC [virtual]\fR"
Sets the value of the node to \fIv\fR.
.PP
See also nodeValue().
.SH "void QDomNode::setPrefix ( const QString & pre )\fC [virtual]\fR"
If the node has a namespace prefix, this function changes the namespace prefix of the node to \fIpre\fR. Otherwise this function has no effect.
.PP
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace prefix must have be specified at creation time; it is not possible to add a namespace prefix afterwards.
.PP
See also prefix(), localName(), namespaceURI(), QDomDocument::createElementNS() and QDomDocument::createAttributeNS().
.SH "QDomAttr QDomNode::toAttr ()"
Converts a QDomNode into a QDomAttr. If the node is not an attribute, the returned object will be null.
.PP
See also isAttr().
.SH "QDomCDATASection QDomNode::toCDATASection ()"
Converts a QDomNode into a QDomCDATASection. If the node is not a CDATA section, the returned object will be null.
.PP
See also isCDATASection().
.SH "QDomCharacterData QDomNode::toCharacterData ()"
Converts a QDomNode into a QDomCharacterData. If the node is not a character data node the returned object will be null.
.PP
See also isCharacterData().
.SH "QDomComment QDomNode::toComment ()"
Converts a QDomNode into a QDomComment. If the node is not a comment the returned object will be null.
.PP
See also isComment().
.SH "QDomDocument QDomNode::toDocument ()"
Converts a QDomNode into a QDomDocument. If the node is not a document the returned object will be null.
.PP
See also isDocument().
.SH "QDomDocumentFragment QDomNode::toDocumentFragment ()"
Converts a QDomNode into a QDomDocumentFragment. If the node is not a document fragment the returned object will be null.
.PP
See also isDocumentFragment().
.SH "QDomDocumentType QDomNode::toDocumentType ()"
Converts a QDomNode into a QDomDocumentType. If the node is not a document type the returned object will be null.
.PP
See also isDocumentType().
.SH "QDomElement QDomNode::toElement ()"
Converts a QDomNode into a QDomElement. If the node is not an element the returned object will be null.
.PP
See also isElement().
.PP
Example: xml/outliner/outlinetree.cpp.
.SH "QDomEntity QDomNode::toEntity ()"
Converts a QDomNode into a QDomEntity. If the node is not an entity the returned object will be null.
.PP
See also isEntity().
.SH "QDomEntityReference QDomNode::toEntityReference ()"
Converts a QDomNode into a QDomEntityReference. If the node is not an entity reference, the returned object will be null.
.PP
See also isEntityReference().
.SH "QDomNotation QDomNode::toNotation ()"
Converts a QDomNode into a QDomNotation. If the node is not a notation the returned object will be null.
.PP
See also isNotation().
.SH "QDomProcessingInstruction QDomNode::toProcessingInstruction ()"
Converts a QDomNode into a QDomProcessingInstruction. If the node is not a processing instruction the returned object will be null.
.PP
See also isProcessingInstruction().
.SH "QDomText QDomNode::toText ()"
Converts a QDomNode into a QDomText. If the node is not a text, the returned object will be null.
.PP
See also isText().
.SH RELATED FUNCTION DOCUMENTATION
.SH "QTextStream & operator<< ( QTextStream & str, const QDomNode & node )"
Writes the XML representation of the node \fInode\fR and all its children to the
stream \fIstr\fR.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qdomnode.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2001 Trolltech AS, 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 Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt 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 qt-bugs@trolltech.com .
Please include the name of the manual page (qdomnode.3qt) and the Qt
version (3.0.3).
|