ReactOS 0.4.15-dev-7953-g1f49173
tinyxml2::XMLNode Class Referenceabstract

#include <tinyxml2.h>

Inheritance diagram for tinyxml2::XMLNode:
Collaboration diagram for tinyxml2::XMLNode:

Public Member Functions

const XMLDocumentGetDocument () const
 Get the XMLDocument that owns this XMLNode.
 
XMLDocumentGetDocument ()
 Get the XMLDocument that owns this XMLNode.
 
virtual XMLElementToElement ()
 Safely cast to an Element, or null.
 
virtual XMLTextToText ()
 Safely cast to Text, or null.
 
virtual XMLCommentToComment ()
 Safely cast to a Comment, or null.
 
virtual XMLDocumentToDocument ()
 Safely cast to a Document, or null.
 
virtual XMLDeclarationToDeclaration ()
 Safely cast to a Declaration, or null.
 
virtual XMLUnknownToUnknown ()
 Safely cast to an Unknown, or null.
 
virtual const XMLElementToElement () const
 
virtual const XMLTextToText () const
 
virtual const XMLCommentToComment () const
 
virtual const XMLDocumentToDocument () const
 
virtual const XMLDeclarationToDeclaration () const
 
virtual const XMLUnknownToUnknown () const
 
const charValue () const
 
void SetValue (const char *val, bool staticMem=false)
 
const XMLNodeParent () const
 Get the parent of this node on the DOM.
 
XMLNodeParent ()
 
bool NoChildren () const
 Returns true if this node has no children.
 
const XMLNodeFirstChild () const
 Get the first child node, or null if none exists.
 
XMLNodeFirstChild ()
 
const XMLElementFirstChildElement (const char *name=0) const
 
XMLElementFirstChildElement (const char *name=0)
 
const XMLNodeLastChild () const
 Get the last child node, or null if none exists.
 
XMLNodeLastChild ()
 
const XMLElementLastChildElement (const char *name=0) const
 
XMLElementLastChildElement (const char *name=0)
 
const XMLNodePreviousSibling () const
 Get the previous (left) sibling node of this node.
 
XMLNodePreviousSibling ()
 
const XMLElementPreviousSiblingElement (const char *name=0) const
 Get the previous (left) sibling element of this node, with an optionally supplied name.
 
XMLElementPreviousSiblingElement (const char *name=0)
 
const XMLNodeNextSibling () const
 Get the next (right) sibling node of this node.
 
XMLNodeNextSibling ()
 
const XMLElementNextSiblingElement (const char *name=0) const
 Get the next (right) sibling element of this node, with an optionally supplied name.
 
XMLElementNextSiblingElement (const char *name=0)
 
XMLNodeInsertEndChild (XMLNode *addThis)
 
XMLNodeLinkEndChild (XMLNode *addThis)
 
XMLNodeInsertFirstChild (XMLNode *addThis)
 
XMLNodeInsertAfterChild (XMLNode *afterThis, XMLNode *addThis)
 
void DeleteChildren ()
 
void DeleteChild (XMLNode *node)
 
virtual XMLNodeShallowClone (XMLDocument *document) const =0
 
virtual bool ShallowEqual (const XMLNode *compare) const =0
 
virtual bool Accept (XMLVisitor *visitor) const =0
 

Protected Member Functions

 XMLNode (XMLDocument *)
 
virtual ~XMLNode ()
 
virtual charParseDeep (char *, StrPair *)
 

Protected Attributes

XMLDocument_document
 
XMLNode_parent
 
StrPair _value
 
XMLNode_firstChild
 
XMLNode_lastChild
 
XMLNode_prev
 
XMLNode_next
 

Private Member Functions

void Unlink (XMLNode *child)
 
void InsertChildPreamble (XMLNode *insertThis) const
 
 XMLNode (const XMLNode &)
 
XMLNodeoperator= (const XMLNode &)
 

Static Private Member Functions

static void DeleteNode (XMLNode *node)
 

Private Attributes

MemPool_memPool
 

Friends

class XMLDocument
 
class XMLElement
 

Detailed Description

XMLNode is a base class for every object that is in the XML Document Object Model (DOM), except XMLAttributes. Nodes have siblings, a parent, and children which can be navigated. A node is always in a XMLDocument. The type of a XMLNode can be queried, and it can be cast to its more defined type.

A XMLDocument allocates memory for all its Nodes. When the XMLDocument gets deleted, all its Nodes will also be deleted.

A Document can contain: Element (container or leaf)
                        Comment (leaf)
                        Unknown (leaf)
                        Declaration( leaf )

An Element can contain: Element (container or leaf)
                        Text    (leaf)
                        Attributes (not on tree)
                        Comment (leaf)
                        Unknown (leaf)

Definition at line 613 of file tinyxml2.h.

Constructor & Destructor Documentation

◆ XMLNode() [1/2]

tinyxml2::XMLNode::XMLNode ( XMLDocument doc)
protected

Definition at line 701 of file tinyxml2.cpp.

701 :
702 _document( doc ),
703 _parent( 0 ),
704 _firstChild( 0 ), _lastChild( 0 ),
705 _prev( 0 ), _next( 0 ),
706 _memPool( 0 )
707{
708}
XMLNode * _lastChild
Definition: tinyxml2.h:866
XMLNode * _parent
Definition: tinyxml2.h:862
XMLNode * _next
Definition: tinyxml2.h:869
MemPool * _memPool
Definition: tinyxml2.h:872
XMLDocument * _document
Definition: tinyxml2.h:861
XMLNode * _prev
Definition: tinyxml2.h:868
XMLNode * _firstChild
Definition: tinyxml2.h:865

◆ ~XMLNode()

tinyxml2::XMLNode::~XMLNode ( )
protectedvirtual

Definition at line 711 of file tinyxml2.cpp.

712{
714 if ( _parent ) {
715 _parent->Unlink( this );
716 }
717}
void DeleteChildren()
Definition: tinyxml2.cpp:738
void Unlink(XMLNode *child)
Definition: tinyxml2.cpp:752

◆ XMLNode() [2/2]

tinyxml2::XMLNode::XMLNode ( const XMLNode )
private

Member Function Documentation

◆ Accept()

virtual bool tinyxml2::XMLNode::Accept ( XMLVisitor visitor) const
pure virtual

Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.

This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)

The interface has been based on ideas from:

Which are both good references for "visiting".

An example of using Accept():

XMLPrinter printer;
tinyxmlDoc.Accept( &printer );
const char* xmlcstr = printer.CStr();

Implemented in tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, tinyxml2::XMLElement, and tinyxml2::XMLDocument.

◆ DeleteChild()

void tinyxml2::XMLNode::DeleteChild ( XMLNode node)

Delete a child of this node.

Definition at line 774 of file tinyxml2.cpp.

775{
776 TIXMLASSERT( node );
777 TIXMLASSERT( node->_document == _document );
778 TIXMLASSERT( node->_parent == this );
779 Unlink( node );
780 DeleteNode( node );
781}
static void DeleteNode(XMLNode *node)
Definition: tinyxml2.cpp:1017
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88
Definition: dlist.c:348

◆ DeleteChildren()

void tinyxml2::XMLNode::DeleteChildren ( )

Delete all the children of this node.

Definition at line 738 of file tinyxml2.cpp.

739{
740 while( _firstChild ) {
744 Unlink( node );
745
746 DeleteNode( node );
747 }
749}
XMLNode(XMLDocument *)
Definition: tinyxml2.cpp:701

Referenced by tinyxml2::XMLDocument::Clear(), tinyxml2::XMLDocument::Parse(), and ~XMLNode().

◆ DeleteNode()

void tinyxml2::XMLNode::DeleteNode ( XMLNode node)
staticprivate

Definition at line 1017 of file tinyxml2.cpp.

1018{
1019 if ( node == 0 ) {
1020 return;
1021 }
1022 MemPool* pool = node->_memPool;
1023 node->~XMLNode();
1024 pool->Free( node );
1025}

Referenced by DeleteChild(), DeleteChildren(), tinyxml2::XMLDocument::DeleteNode(), and ParseDeep().

◆ FirstChild() [1/2]

XMLNode * tinyxml2::XMLNode::FirstChild ( )
inline

Definition at line 709 of file tinyxml2.h.

709 {
710 return _firstChild;
711 }

◆ FirstChild() [2/2]

◆ FirstChildElement() [1/2]

XMLElement * tinyxml2::XMLNode::FirstChildElement ( const char name = 0)
inline

Definition at line 718 of file tinyxml2.h.

718 {
719 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( name ));
720 }
const XMLElement * FirstChildElement(const char *name=0) const
Definition: tinyxml2.cpp:876
friend class XMLElement
Definition: tinyxml2.h:616
Definition: name.c:39

◆ FirstChildElement() [2/2]

const XMLElement * tinyxml2::XMLNode::FirstChildElement ( const char name = 0) const

Get the first child element, or optionally the first child element with the specified name.

Definition at line 876 of file tinyxml2.cpp.

877{
878 for( const XMLNode* node = _firstChild; node; node = node->_next ) {
879 const XMLElement* element = node->ToElement();
880 if ( element ) {
881 if ( !name || XMLUtil::StringEqual( element->Name(), name ) ) {
882 return element;
883 }
884 }
885 }
886 return 0;
887}
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:555

◆ GetDocument() [1/2]

XMLDocument * tinyxml2::XMLNode::GetDocument ( )
inline

Get the XMLDocument that owns this XMLNode.

Definition at line 625 of file tinyxml2.h.

625 {
627 return _document;
628 }

◆ GetDocument() [2/2]

const XMLDocument * tinyxml2::XMLNode::GetDocument ( ) const
inline

Get the XMLDocument that owns this XMLNode.

Definition at line 620 of file tinyxml2.h.

620 {
622 return _document;
623 }

Referenced by tinyxml2::XMLElement::SetText().

◆ InsertAfterChild()

XMLNode * tinyxml2::XMLNode::InsertAfterChild ( XMLNode afterThis,
XMLNode addThis 
)

Add a node after the specified child node. If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the afterThis node is not a child of this node, or if the node does not belong to the same document.

Definition at line 845 of file tinyxml2.cpp.

846{
847 TIXMLASSERT( addThis );
848 if ( addThis->_document != _document ) {
849 TIXMLASSERT( false );
850 return 0;
851 }
852
853 TIXMLASSERT( afterThis );
854
855 if ( afterThis->_parent != this ) {
856 TIXMLASSERT( false );
857 return 0;
858 }
859
860 if ( afterThis->_next == 0 ) {
861 // The last node or the only node.
862 return InsertEndChild( addThis );
863 }
864 InsertChildPreamble( addThis );
865 addThis->_prev = afterThis;
866 addThis->_next = afterThis->_next;
867 afterThis->_next->_prev = addThis;
868 afterThis->_next = addThis;
869 addThis->_parent = this;
870 return addThis;
871}
void InsertChildPreamble(XMLNode *insertThis) const
Definition: tinyxml2.cpp:1027
XMLNode * InsertEndChild(XMLNode *addThis)
Definition: tinyxml2.cpp:784

◆ InsertChildPreamble()

void tinyxml2::XMLNode::InsertChildPreamble ( XMLNode insertThis) const
private

Definition at line 1027 of file tinyxml2.cpp.

1028{
1029 TIXMLASSERT( insertThis );
1030 TIXMLASSERT( insertThis->_document == _document );
1031
1032 if ( insertThis->_parent )
1033 insertThis->_parent->Unlink( insertThis );
1034 else
1035 insertThis->_memPool->SetTracked();
1036}

Referenced by InsertAfterChild(), InsertEndChild(), and InsertFirstChild().

◆ InsertEndChild()

XMLNode * tinyxml2::XMLNode::InsertEndChild ( XMLNode addThis)

Add a child node as the last (right) child. If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the node does not belong to the same document.

Definition at line 784 of file tinyxml2.cpp.

785{
786 TIXMLASSERT( addThis );
787 if ( addThis->_document != _document ) {
788 TIXMLASSERT( false );
789 return 0;
790 }
791 InsertChildPreamble( addThis );
792
793 if ( _lastChild ) {
796 _lastChild->_next = addThis;
797 addThis->_prev = _lastChild;
798 _lastChild = addThis;
799
800 addThis->_next = 0;
801 }
802 else {
803 TIXMLASSERT( _firstChild == 0 );
804 _firstChild = _lastChild = addThis;
805
806 addThis->_prev = 0;
807 addThis->_next = 0;
808 }
809 addThis->_parent = this;
810 return addThis;
811}

Referenced by InsertAfterChild(), and ParseDeep().

◆ InsertFirstChild()

XMLNode * tinyxml2::XMLNode::InsertFirstChild ( XMLNode addThis)

Add a child node as the first (left) child. If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the node does not belong to the same document.

Definition at line 814 of file tinyxml2.cpp.

815{
816 TIXMLASSERT( addThis );
817 if ( addThis->_document != _document ) {
818 TIXMLASSERT( false );
819 return 0;
820 }
821 InsertChildPreamble( addThis );
822
823 if ( _firstChild ) {
826
827 _firstChild->_prev = addThis;
828 addThis->_next = _firstChild;
829 _firstChild = addThis;
830
831 addThis->_prev = 0;
832 }
833 else {
834 TIXMLASSERT( _lastChild == 0 );
835 _firstChild = _lastChild = addThis;
836
837 addThis->_prev = 0;
838 addThis->_next = 0;
839 }
840 addThis->_parent = this;
841 return addThis;
842}

Referenced by tinyxml2::XMLElement::SetText().

◆ LastChild() [1/2]

XMLNode * tinyxml2::XMLNode::LastChild ( )
inline

Definition at line 727 of file tinyxml2.h.

727 {
728 return _lastChild;
729 }

◆ LastChild() [2/2]

const XMLNode * tinyxml2::XMLNode::LastChild ( ) const
inline

Get the last child node, or null if none exists.

Definition at line 723 of file tinyxml2.h.

723 {
724 return _lastChild;
725 }

◆ LastChildElement() [1/2]

XMLElement * tinyxml2::XMLNode::LastChildElement ( const char name = 0)
inline

Definition at line 736 of file tinyxml2.h.

736 {
737 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(name) );
738 }
const XMLElement * LastChildElement(const char *name=0) const
Definition: tinyxml2.cpp:890

◆ LastChildElement() [2/2]

const XMLElement * tinyxml2::XMLNode::LastChildElement ( const char name = 0) const

Get the last child element or optionally the last child element with the specified name.

Definition at line 890 of file tinyxml2.cpp.

891{
892 for( const XMLNode* node = _lastChild; node; node = node->_prev ) {
893 const XMLElement* element = node->ToElement();
894 if ( element ) {
895 if ( !name || XMLUtil::StringEqual( element->Name(), name ) ) {
896 return element;
897 }
898 }
899 }
900 return 0;
901}

◆ LinkEndChild()

XMLNode * tinyxml2::XMLNode::LinkEndChild ( XMLNode addThis)
inline

Definition at line 781 of file tinyxml2.h.

781 {
782 return InsertEndChild( addThis );
783 }

◆ NextSibling() [1/2]

XMLNode * tinyxml2::XMLNode::NextSibling ( )
inline

Definition at line 761 of file tinyxml2.h.

761 {
762 return _next;
763 }

◆ NextSibling() [2/2]

const XMLNode * tinyxml2::XMLNode::NextSibling ( ) const
inline

Get the next (right) sibling node of this node.

Definition at line 757 of file tinyxml2.h.

757 {
758 return _next;
759 }

◆ NextSiblingElement() [1/2]

XMLElement * tinyxml2::XMLNode::NextSiblingElement ( const char name = 0)
inline

Definition at line 768 of file tinyxml2.h.

768 {
769 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( name ) );
770 }
const XMLElement * NextSiblingElement(const char *name=0) const
Get the next (right) sibling element of this node, with an optionally supplied name.
Definition: tinyxml2.cpp:904

◆ NextSiblingElement() [2/2]

const XMLElement * tinyxml2::XMLNode::NextSiblingElement ( const char name = 0) const

Get the next (right) sibling element of this node, with an optionally supplied name.

Definition at line 904 of file tinyxml2.cpp.

905{
906 for( const XMLNode* node = _next; node; node = node->_next ) {
907 const XMLElement* element = node->ToElement();
908 if ( element
909 && (!name || XMLUtil::StringEqual( name, element->Name() ))) {
910 return element;
911 }
912 }
913 return 0;
914}

◆ NoChildren()

bool tinyxml2::XMLNode::NoChildren ( ) const
inline

Returns true if this node has no children.

Definition at line 700 of file tinyxml2.h.

700 {
701 return !_firstChild;
702 }

Referenced by tinyxml2::XMLDocument::Parse(), and ParseDeep().

◆ operator=()

XMLNode & tinyxml2::XMLNode::operator= ( const XMLNode )
private

◆ Parent() [1/2]

XMLNode * tinyxml2::XMLNode::Parent ( )
inline

Definition at line 695 of file tinyxml2.h.

695 {
696 return _parent;
697 }

◆ Parent() [2/2]

const XMLNode * tinyxml2::XMLNode::Parent ( ) const
inline

Get the parent of this node on the DOM.

Definition at line 691 of file tinyxml2.h.

691 {
692 return _parent;
693 }

◆ ParseDeep()

char * tinyxml2::XMLNode::ParseDeep ( char p,
StrPair parentEnd 
)
protectedvirtual

Reimplemented in tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, and tinyxml2::XMLElement.

Definition at line 930 of file tinyxml2.cpp.

931{
932 // This is a recursive method, but thinking about it "at the current level"
933 // it is a pretty simple flat list:
934 // <foo/>
935 // <!-- comment -->
936 //
937 // With a special case:
938 // <foo>
939 // </foo>
940 // <!-- comment -->
941 //
942 // Where the closing element (/foo) *must* be the next thing after the opening
943 // element, and the names must match. BUT the tricky bit is that the closing
944 // element will be read by the child.
945 //
946 // 'endTag' is the end tag for this node, it is returned by a call to a child.
947 // 'parentEnd' is the end tag for the parent, which is filled in and returned.
948
949 while( p && *p ) {
950 XMLNode* node = 0;
951
952 p = _document->Identify( p, &node );
953 if ( node == 0 ) {
954 break;
955 }
956
957 StrPair endTag;
958 p = node->ParseDeep( p, &endTag );
959 if ( !p ) {
960 DeleteNode( node );
961 if ( !_document->Error() ) {
963 }
964 break;
965 }
966
967 XMLDeclaration* decl = node->ToDeclaration();
968 if ( decl ) {
969 // A declaration can only be the first child of a document.
970 // Set error, if document already has children.
971 if ( !_document->NoChildren() ) {
973 DeleteNode( decl );
974 break;
975 }
976 }
977
978 XMLElement* ele = node->ToElement();
979 if ( ele ) {
980 // We read the end tag. Return it to the parent.
981 if ( ele->ClosingType() == XMLElement::CLOSING ) {
982 if ( parentEnd ) {
983 ele->_value.TransferTo( parentEnd );
984 }
985 node->_memPool->SetTracked(); // created and then immediately deleted.
986 DeleteNode( node );
987 return p;
988 }
989
990 // Handle an end tag returned to this level.
991 // And handle a bunch of annoying errors.
992 bool mismatch = false;
993 if ( endTag.Empty() ) {
994 if ( ele->ClosingType() == XMLElement::OPEN ) {
995 mismatch = true;
996 }
997 }
998 else {
999 if ( ele->ClosingType() != XMLElement::OPEN ) {
1000 mismatch = true;
1001 }
1002 else if ( !XMLUtil::StringEqual( endTag.GetStr(), ele->Name() ) ) {
1003 mismatch = true;
1004 }
1005 }
1006 if ( mismatch ) {
1008 DeleteNode( node );
1009 break;
1010 }
1011 }
1013 }
1014 return 0;
1015}
_STLP_INLINE_LOOP _STLP_STD::pair< _InputIter1, _InputIter2 > mismatch(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2)
Definition: _algobase.h:522
char * Identify(char *p, XMLNode **node)
Definition: tinyxml2.cpp:611
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1677
void SetError(XMLError error, const char *str1, const char *str2)
Definition: tinyxml2.cpp:2053
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:700
GLfloat GLfloat p
Definition: glext.h:8902
@ XML_ERROR_MISMATCHED_ELEMENT
Definition: tinyxml2.h:504
@ XML_ERROR_PARSING_DECLARATION
Definition: tinyxml2.h:501
@ XML_ERROR_PARSING
Definition: tinyxml2.h:505

Referenced by tinyxml2::XMLDocument::Parse(), and tinyxml2::XMLElement::ParseDeep().

◆ PreviousSibling() [1/2]

XMLNode * tinyxml2::XMLNode::PreviousSibling ( )
inline

Definition at line 745 of file tinyxml2.h.

745 {
746 return _prev;
747 }

◆ PreviousSibling() [2/2]

const XMLNode * tinyxml2::XMLNode::PreviousSibling ( ) const
inline

Get the previous (left) sibling node of this node.

Definition at line 741 of file tinyxml2.h.

741 {
742 return _prev;
743 }

◆ PreviousSiblingElement() [1/2]

XMLElement * tinyxml2::XMLNode::PreviousSiblingElement ( const char name = 0)
inline

Definition at line 752 of file tinyxml2.h.

752 {
753 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( name ) );
754 }
const XMLElement * PreviousSiblingElement(const char *name=0) const
Get the previous (left) sibling element of this node, with an optionally supplied name.
Definition: tinyxml2.cpp:917

◆ PreviousSiblingElement() [2/2]

const XMLElement * tinyxml2::XMLNode::PreviousSiblingElement ( const char name = 0) const

Get the previous (left) sibling element of this node, with an optionally supplied name.

Definition at line 917 of file tinyxml2.cpp.

918{
919 for( const XMLNode* node = _prev; node; node = node->_prev ) {
920 const XMLElement* element = node->ToElement();
921 if ( element
922 && (!name || XMLUtil::StringEqual( name, element->Name() ))) {
923 return element;
924 }
925 }
926 return 0;
927}

◆ SetValue()

void tinyxml2::XMLNode::SetValue ( const char val,
bool  staticMem = false 
)

Set the Value of an XML node.

See also
Value()

Definition at line 727 of file tinyxml2.cpp.

728{
729 if ( staticMem ) {
731 }
732 else {
733 _value.SetStr( str );
734 }
735}
void SetStr(const char *str, int flags=0)
Definition: tinyxml2.cpp:178
void SetInternedStr(const char *str)
Definition: tinyxml2.h:148
StrPair _value
Definition: tinyxml2.h:863
const WCHAR * str

Referenced by tinyxml2::XMLDocument::NewUnknown(), and tinyxml2::XMLElement::SetText().

◆ ShallowClone()

virtual XMLNode * tinyxml2::XMLNode::ShallowClone ( XMLDocument document) const
pure virtual

Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())

Note: if called on a XMLDocument, this will return null.

Implemented in tinyxml2::XMLDocument, tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, and tinyxml2::XMLElement.

◆ ShallowEqual()

virtual bool tinyxml2::XMLNode::ShallowEqual ( const XMLNode compare) const
pure virtual

Test if 2 nodes are the same, but don't test children. The 2 nodes do not need to be in the same Document.

Note: if called on a XMLDocument, this will return false.

Implemented in tinyxml2::XMLDocument, tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, and tinyxml2::XMLElement.

◆ ToComment() [1/2]

virtual XMLComment * tinyxml2::XMLNode::ToComment ( )
inlinevirtual

Safely cast to a Comment, or null.

Reimplemented in tinyxml2::XMLComment.

Definition at line 639 of file tinyxml2.h.

639 {
640 return 0;
641 }

◆ ToComment() [2/2]

virtual const XMLComment * tinyxml2::XMLNode::ToComment ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLComment.

Definition at line 661 of file tinyxml2.h.

661 {
662 return 0;
663 }

◆ ToDeclaration() [1/2]

virtual XMLDeclaration * tinyxml2::XMLNode::ToDeclaration ( )
inlinevirtual

Safely cast to a Declaration, or null.

Reimplemented in tinyxml2::XMLDeclaration.

Definition at line 647 of file tinyxml2.h.

647 {
648 return 0;
649 }

◆ ToDeclaration() [2/2]

virtual const XMLDeclaration * tinyxml2::XMLNode::ToDeclaration ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLDeclaration.

Definition at line 667 of file tinyxml2.h.

667 {
668 return 0;
669 }

◆ ToDocument() [1/2]

virtual XMLDocument * tinyxml2::XMLNode::ToDocument ( )
inlinevirtual

Safely cast to a Document, or null.

Reimplemented in tinyxml2::XMLDocument.

Definition at line 643 of file tinyxml2.h.

643 {
644 return 0;
645 }

Referenced by Value().

◆ ToDocument() [2/2]

virtual const XMLDocument * tinyxml2::XMLNode::ToDocument ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLDocument.

Definition at line 664 of file tinyxml2.h.

664 {
665 return 0;
666 }

◆ ToElement() [1/2]

virtual XMLElement * tinyxml2::XMLNode::ToElement ( )
inlinevirtual

Safely cast to an Element, or null.

Reimplemented in tinyxml2::XMLElement.

Definition at line 631 of file tinyxml2.h.

631 {
632 return 0;
633 }

◆ ToElement() [2/2]

virtual const XMLElement * tinyxml2::XMLNode::ToElement ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLElement.

Definition at line 655 of file tinyxml2.h.

655 {
656 return 0;
657 }

◆ ToText() [1/2]

◆ ToText() [2/2]

virtual const XMLText * tinyxml2::XMLNode::ToText ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLText.

Definition at line 658 of file tinyxml2.h.

658 {
659 return 0;
660 }

◆ ToUnknown() [1/2]

virtual XMLUnknown * tinyxml2::XMLNode::ToUnknown ( )
inlinevirtual

Safely cast to an Unknown, or null.

Reimplemented in tinyxml2::XMLUnknown.

Definition at line 651 of file tinyxml2.h.

651 {
652 return 0;
653 }

◆ ToUnknown() [2/2]

virtual const XMLUnknown * tinyxml2::XMLNode::ToUnknown ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLUnknown.

Definition at line 670 of file tinyxml2.h.

670 {
671 return 0;
672 }

◆ Unlink()

void tinyxml2::XMLNode::Unlink ( XMLNode child)
private

Definition at line 752 of file tinyxml2.cpp.

753{
755 TIXMLASSERT( child->_document == _document );
756 TIXMLASSERT( child->_parent == this );
757 if ( child == _firstChild ) {
759 }
760 if ( child == _lastChild ) {
762 }
763
764 if ( child->_prev ) {
765 child->_prev->_next = child->_next;
766 }
767 if ( child->_next ) {
768 child->_next->_prev = child->_prev;
769 }
770 child->_parent = 0;
771}
static HWND child
Definition: cursoricon.c:298

Referenced by DeleteChild(), DeleteChildren(), InsertChildPreamble(), and ~XMLNode().

◆ Value()

const char * tinyxml2::XMLNode::Value ( ) const

The meaning of 'value' changes for the specific type.

Document:   empty (NULL is returned, not an empty string)
Element:    name of the element
Comment:    the comment text
Unknown:    the tag contents
Text:       the text string

Definition at line 719 of file tinyxml2.cpp.

720{
721 // Catch an edge case: XMLDocuments don't have a a Value. Carefully return nullptr.
722 if ( this->ToDocument() )
723 return 0;
724 return _value.GetStr();
725}
const char * GetStr()
Definition: tinyxml2.cpp:260
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:643

Referenced by tinyxml2::XMLElement::GetText(), ParseDeep(), tinyxml2::XMLElement::QueryBoolText(), tinyxml2::XMLElement::QueryDoubleText(), tinyxml2::XMLElement::QueryFloatText(), tinyxml2::XMLElement::QueryIntText(), tinyxml2::XMLElement::QueryUnsignedText(), tinyxml2::XMLText::ShallowClone(), tinyxml2::XMLComment::ShallowClone(), tinyxml2::XMLDeclaration::ShallowClone(), tinyxml2::XMLUnknown::ShallowClone(), tinyxml2::XMLElement::ShallowClone(), ToNodeName(), and ToString().

Friends And Related Function Documentation

◆ XMLDocument

friend class XMLDocument
friend

Definition at line 615 of file tinyxml2.h.

◆ XMLElement

friend class XMLElement
friend

Definition at line 616 of file tinyxml2.h.

Member Data Documentation

◆ _document

◆ _firstChild

XMLNode* tinyxml2::XMLNode::_firstChild
protected

◆ _lastChild

XMLNode* tinyxml2::XMLNode::_lastChild
protected

◆ _memPool

◆ _next

XMLNode* tinyxml2::XMLNode::_next
protected

◆ _parent

XMLNode* tinyxml2::XMLNode::_parent
protected

◆ _prev

XMLNode* tinyxml2::XMLNode::_prev
protected

◆ _value


The documentation for this class was generated from the following files: