📄 qdomnode.3qt
字号:
'\" t.TH QDomNode 3qt "24 January 2005" "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 NAMEQDomNode \- The base class for all nodes of the DOM tree.br.PP\fC#include <qdom.h>\fR.PPInherited by QDomAttr, QDomCharacterData, QDomDocument, QDomDocumentFragment, QDomDocumentType, QDomElement, QDomEntity, QDomEntityReference, QDomNotation and QDomProcessingInstruction..PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBNodeType\fR { BaseNode = 0, ElementNode = 1, AttributeNode = 2, TextNode = 3, CDATASectionNode = 4, EntityReferenceNode = 5, EntityNode = 6, ProcessingInstructionNode = 7, CommentNode = 8, DocumentNode = 9, DocumentTypeNode = 10, DocumentFragmentNode = 11, NotationNode = 12, CharacterDataNode = 13 }".br.ti -1c.BI "\fBQDomNode\fR () ".br.ti -1c.BI "\fBQDomNode\fR ( const QDomNode & ) ".br.ti -1c.BI "QDomNode& \fBoperator=\fR ( const QDomNode & ) ".br.ti -1c.BI "bool \fBoperator==\fR ( const QDomNode & ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QDomNode & ) const".br.ti -1c.BI "virtual \fB~QDomNode\fR () ".br.ti -1c.BI "virtual QString \fBnodeName\fR () const".br.ti -1c.BI "virtual QString \fBnodeValue\fR () const".br.ti -1c.BI "virtual void \fBsetNodeValue\fR ( const QString & ) ".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 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 QDomNode \fBcloneNode\fR ( bool " "deep" " = TRUE ) const".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 &, int ) const".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "\fBQDomNode\fR ( QDOM_NodePrivate * ) (internal)".br.in -1c.SH DESCRIPTIONThe QDomNode class is the base class for all nodes of the DOM tree..PPThis class is the base class for almost all other classes in the DOM. Many functions in the DOM return a QDomNode. The various isXxx() functions are useful to find out the type of the node. A QDomNode can be converted to a subclass by using the toXxx() function family..PPCopies of the QDomNode class share their data; this means modifying one will change all copies. This is especially useful in combination with functions which return a QDomNode, e.g. firstChild(). You can make an independent copy of the node with cloneNode()..PPThe following example looks for the first element in an XML document and prints its name:.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 << "The name of the element is " << e.tagName() << endl;.br return;.br }.br n = n.nextSibling();.br }.br cout << "no element in the Document" << endl;.fi.PPFor further information about the Document Objct Model see http://www.w3.org/TR/REC-DOM-Level-1/. For a more general introduction of the DOM implementation see the QDomDocument documentation..SH MEMBER FUNCTION DOCUMENTATION.SH "QDomNode::QDomNode ()"Constructs an empty node..SH "QDomNode::QDomNode ( const QDomNode & n )"Copy constructor..PPThe data of the copy is shared: modifying one will also change the other. If you want to make a real copy, use cloneNode() instead..SH "QDomNode::~QDomNode () \fC[virtual]\fR"Destructor..SH "QDomNode QDomNode::appendChild ( const QDomNode & newChild ) \fC[virtual]\fR"Appends \fInewChild\fR to the end of the children list..PPIf \fInewChild\fR is currently child of another parent, then it is reparented. If \fInewChild\fR is currently a child of this QDomNode, then its position in the list of children is changed..PPReturns a new reference to \fInewChild.\fR.PPSee also insertBefore(), insertAfter(), replaceChild() and removeChild()..SH "QDomNamedNodeMap QDomNode::attributes () const \fC[virtual]\fR"Returns a map of all attributes. Attributes are only provided for QDomElement..PPChanging the attributes in the map will also change the attributes of this QDomNode..PPReimplemented in QDomElement..SH "QDomNodeList QDomNode::childNodes () const \fC[virtual]\fR"Returns a list of all child nodes..PPMost often you will call this function on a QDomElement object. If the XML document looks like this:.PP.nf.br <body>.br <h1>Heading</h1>.br <p>Hallo <b>you</b></p>.br </body>.fi.PPThen 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..PPThe nodes in the list are not copied; so changing the nodes in the list will also change the children of this node..PPSee also firstChild() and lastChild()..SH "void QDomNode::clear ()"Dereferences the internal object. The node is then a null node..PPSee also isNull()..SH "QDomNode QDomNode::cloneNode ( bool deep = TRUE ) const \fC[virtual]\fR"Creates a real copy of the QDomNode..PPIf \fIdeep\fR is TRUE, then the cloning is done recursive. That means all children are copied, too. Otherwise the cloned node does not contain 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..PPSee also lastChild() and childNodes()..SH "QDomNode QDomNode::insertAfter ( const QDomNode & newChild, const QDomNode & refChild ) \fC[virtual]\fR"Inserts the node \fInewChild\fR after the child node \fIrefChild. refChild\fR has to be a direct child of this node. If \fIrefChild\fR is null then \fInewChild\fR is appended as last child..PPIf \fInewChild\fR is currently child of another parent, then it is reparented. If \fInewChild\fR is currently a child of this QDomNode, then its position in the list of children is changed..PPIf \fInewChild\fR is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and inserted after \fIrefChild.\fR.PPReturns a new reference to \fInewChild\fR on success or an empty node on failure..PPSee 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. refChild\fR has to be a direct child of this node. If \fIrefChild\fR is null then \fInewChild\fR is inserted as first child..PPIf \fInewChild\fR is currently child of another parent, then it is reparented. If \fInewChild\fR is currently a child of this QDomNode, then its position in the list of children is changed..PPIf \fInewChild\fR is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and inserted after \fIrefChild.\fR.PPReturns a new reference to \fInewChild\fR on success or an empty node on failure..PPSee also insertAfter(), replaceChild(), removeChild() and appendChild()..SH "bool QDomNode::isAttr () const \fC[virtual]\fR"Returns TRUE if the node is an attribute, otherwise FALSE..PPIf this function returns TRUE, this does not imply that this object is a QDomAttribute; you can get the QDomAttribute with toAttribute()..PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -