antioch-0.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
tinyxml2::XMLNode Class Referenceabstract

#include <tinyxml2.h>

Inheritance diagram for tinyxml2::XMLNode:
tinyxml2::XMLComment tinyxml2::XMLDeclaration tinyxml2::XMLDocument tinyxml2::XMLElement tinyxml2::XMLText tinyxml2::XMLUnknown

Public Member Functions

const XMLDocumentGetDocument () const
 Get the XMLDocument that owns this XMLNode. More...
 
XMLDocumentGetDocument ()
 Get the XMLDocument that owns this XMLNode. More...
 
virtual XMLElementToElement ()
 Safely cast to an Element, or null. More...
 
virtual XMLTextToText ()
 Safely cast to Text, or null. More...
 
virtual XMLCommentToComment ()
 Safely cast to a Comment, or null. More...
 
virtual XMLDocumentToDocument ()
 Safely cast to a Document, or null. More...
 
virtual XMLDeclarationToDeclaration ()
 Safely cast to a Declaration, or null. More...
 
virtual XMLUnknownToUnknown ()
 Safely cast to an Unknown, or null. More...
 
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 char * Value () const
 
void SetValue (const char *val, bool staticMem=false)
 
const XMLNodeParent () const
 Get the parent of this node on the DOM. More...
 
XMLNodeParent ()
 
bool NoChildren () const
 Returns true if this node has no children. More...
 
const XMLNodeFirstChild () const
 Get the first child node, or null if none exists. More...
 
XMLNodeFirstChild ()
 
const XMLElementFirstChildElement (const char *value=0) const
 
XMLElementFirstChildElement (const char *_value=0)
 
const XMLNodeLastChild () const
 Get the last child node, or null if none exists. More...
 
XMLNodeLastChild ()
 
const XMLElementLastChildElement (const char *value=0) const
 
XMLElementLastChildElement (const char *_value=0)
 
const XMLNodePreviousSibling () const
 Get the previous (left) sibling node of this node. More...
 
XMLNodePreviousSibling ()
 
const XMLElementPreviousSiblingElement (const char *value=0) const
 Get the previous (left) sibling element of this node, with an opitionally supplied name. More...
 
XMLElementPreviousSiblingElement (const char *_value=0)
 
const XMLNodeNextSibling () const
 Get the next (right) sibling node of this node. More...
 
XMLNodeNextSibling ()
 
const XMLElementNextSiblingElement (const char *value=0) const
 Get the next (right) sibling element of this node, with an opitionally supplied name. More...
 
XMLElementNextSiblingElement (const char *_value=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
 
virtual char * ParseDeep (char *, StrPair *)
 

Protected Member Functions

 XMLNode (XMLDocument *)
 
virtual ~XMLNode ()
 
 XMLNode (const XMLNode &)
 
XMLNodeoperator= (const XMLNode &)
 

Protected Attributes

XMLDocumentdocument
 
XMLNodeparent
 
StrPair value
 
XMLNodefirstChild
 
XMLNodelastChild
 
XMLNodeprev
 
XMLNodenext
 

Private Member Functions

void Unlink (XMLNode *child)
 

Private Attributes

MemPoolmemPool
 

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 448 of file tinyxml2.h.

Constructor & Destructor Documentation

XMLNode::XMLNode ( XMLDocument doc)
inlineprotected

Definition at line 599 of file tinyxml2_imp.h.

599  :
600  document( doc ),
601  parent( 0 ),
602  firstChild( 0 ), lastChild( 0 ),
603  prev( 0 ), next( 0 )
604 {
605 }
XMLNode * firstChild
Definition: tinyxml2.h:611
XMLNode * parent
Definition: tinyxml2.h:608
XMLDocument * document
Definition: tinyxml2.h:607
XMLNode * next
Definition: tinyxml2.h:615
XMLNode * lastChild
Definition: tinyxml2.h:612
XMLNode * prev
Definition: tinyxml2.h:614
XMLNode::~XMLNode ( )
inlineprotectedvirtual

Definition at line 609 of file tinyxml2_imp.h.

References DeleteChildren(), parent, and Unlink().

610 {
611  DeleteChildren();
612  if ( parent ) {
613  parent->Unlink( this );
614  }
615 }
void Unlink(XMLNode *child)
Definition: tinyxml2_imp.h:642
XMLNode * parent
Definition: tinyxml2.h:608
tinyxml2::XMLNode::XMLNode ( const XMLNode )
protected

Member Function Documentation

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

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

This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML 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():

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

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

void XMLNode::DeleteChild ( XMLNode node)
inline

Delete a child of this node.

Definition at line 661 of file tinyxml2_imp.h.

References DELETE_NODE, parent, and TIXMLASSERT.

Referenced by tinyxml2::XMLDocument::DeleteNode().

662 {
663  TIXMLASSERT( node->parent == this );
664  DELETE_NODE( node );
665 }
#define DELETE_NODE(node)
Definition: tinyxml2_imp.h:56
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
XMLNode * parent
Definition: tinyxml2.h:608
void XMLNode::DeleteChildren ( )
inline

Delete all the children of this node.

Definition at line 629 of file tinyxml2_imp.h.

References DELETE_NODE, firstChild, lastChild, and Unlink().

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

630 {
631  while( firstChild ) {
632  XMLNode* node = firstChild;
633  Unlink( node );
634 
635  DELETE_NODE( node );
636  }
637  firstChild = lastChild = 0;
638 }
#define DELETE_NODE(node)
Definition: tinyxml2_imp.h:56
void Unlink(XMLNode *child)
Definition: tinyxml2_imp.h:642
XMLNode * firstChild
Definition: tinyxml2.h:611
XMLNode * lastChild
Definition: tinyxml2.h:612
const XMLNode* tinyxml2::XMLNode::FirstChild ( ) const
inline
XMLNode* tinyxml2::XMLNode::FirstChild ( )
inline

Definition at line 497 of file tinyxml2.h.

References firstChild.

497 { return firstChild; }
XMLNode * firstChild
Definition: tinyxml2.h:611
const XMLElement * XMLNode::FirstChildElement ( const char *  value = 0) const
inline

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

Definition at line 740 of file tinyxml2_imp.h.

References firstChild, tinyxml2::XMLElement::Name(), next, tinyxml2::XMLUtil::StringEqual(), tinyxml2::XMLElement::ToElement(), and value.

Referenced by Antioch::XMLParser< NumericType >::efficiencies(), tinyxml2::XMLHandle::FirstChildElement(), tinyxml2::XMLConstHandle::FirstChildElement(), Antioch::XMLParser< NumericType >::get_parameter(), Antioch::XMLParser< NumericType >::products_orders(), Antioch::XMLParser< NumericType >::products_pairs(), Antioch::XMLParser< NumericType >::reactants_orders(), Antioch::XMLParser< NumericType >::reactants_pairs(), Antioch::XMLParser< NumericType >::reaction_kinetics_model(), Antioch::XMLParser< NumericType >::read_thermodynamic_data_root(), tinyxml2::XMLDocument::RootElement(), Antioch::XMLParser< NumericType >::verify_Kooij_in_place_of_Arrhenius(), and Antioch::XMLParser< NumericType >::where_is_k0().

741 {
742  for( XMLNode* node=firstChild; node; node=node->next ) {
743  XMLElement* element = node->ToElement();
744  if ( element ) {
745  if ( !value || XMLUtil::StringEqual( element->Name(), value ) ) {
746  return element;
747  }
748  }
749  }
750  return 0;
751 }
XMLNode * firstChild
Definition: tinyxml2.h:611
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:384
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:861
XMLNode * next
Definition: tinyxml2.h:615
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:865
XMLElement* tinyxml2::XMLNode::FirstChildElement ( const char *  _value = 0)
inline

Definition at line 502 of file tinyxml2.h.

References FirstChildElement().

Referenced by FirstChildElement().

502 { return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( _value )); }
friend class XMLElement
Definition: tinyxml2.h:451
const XMLElement * FirstChildElement(const char *value=0) const
Definition: tinyxml2_imp.h:740
XMLNode(XMLDocument *)
Definition: tinyxml2_imp.h:599
const XMLDocument* tinyxml2::XMLNode::GetDocument ( ) const
inline

Get the XMLDocument that owns this XMLNode.

Definition at line 455 of file tinyxml2.h.

References document.

455 { return document; }
XMLDocument * document
Definition: tinyxml2.h:607
XMLDocument* tinyxml2::XMLNode::GetDocument ( )
inline

Get the XMLDocument that owns this XMLNode.

Definition at line 457 of file tinyxml2.h.

References document.

457 { return document; }
XMLDocument * document
Definition: tinyxml2.h:607
XMLNode * XMLNode::InsertAfterChild ( XMLNode afterThis,
XMLNode addThis 
)
inline

Add a node after the specified child node.

Definition at line 718 of file tinyxml2_imp.h.

References InsertEndChild(), next, parent, prev, and TIXMLASSERT.

719 {
720  TIXMLASSERT( afterThis->parent == this );
721  if ( afterThis->parent != this )
722  return 0;
723 
724  if ( afterThis->next == 0 ) {
725  // The last node or the only node.
726  return InsertEndChild( addThis );
727  }
728  addThis->prev = afterThis;
729  addThis->next = afterThis->next;
730  afterThis->next->prev = addThis;
731  afterThis->next = addThis;
732  addThis->parent = this;
733  return addThis;
734 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
XMLNode * parent
Definition: tinyxml2.h:608
XMLNode * InsertEndChild(XMLNode *addThis)
Definition: tinyxml2_imp.h:669
XMLNode * next
Definition: tinyxml2.h:615
XMLNode * prev
Definition: tinyxml2.h:614
XMLNode * XMLNode::InsertEndChild ( XMLNode addThis)
inline

Add a child node as the last (right) child.

Definition at line 669 of file tinyxml2_imp.h.

References firstChild, lastChild, next, parent, prev, and TIXMLASSERT.

Referenced by InsertAfterChild(), LinkEndChild(), and ParseDeep().

670 {
671  if ( lastChild ) {
673  TIXMLASSERT( lastChild->next == 0 );
674  lastChild->next = addThis;
675  addThis->prev = lastChild;
676  lastChild = addThis;
677 
678  addThis->next = 0;
679  }
680  else {
681  TIXMLASSERT( firstChild == 0 );
682  firstChild = lastChild = addThis;
683 
684  addThis->prev = 0;
685  addThis->next = 0;
686  }
687  addThis->parent = this;
688  return addThis;
689 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
XMLNode * firstChild
Definition: tinyxml2.h:611
XMLNode * parent
Definition: tinyxml2.h:608
XMLNode * next
Definition: tinyxml2.h:615
XMLNode * lastChild
Definition: tinyxml2.h:612
XMLNode * prev
Definition: tinyxml2.h:614
XMLNode * XMLNode::InsertFirstChild ( XMLNode addThis)
inline

Add a child node as the first (left) child.

Definition at line 693 of file tinyxml2_imp.h.

References firstChild, lastChild, next, parent, prev, and TIXMLASSERT.

694 {
695  if ( firstChild ) {
697  TIXMLASSERT( firstChild->prev == 0 );
698 
699  firstChild->prev = addThis;
700  addThis->next = firstChild;
701  firstChild = addThis;
702 
703  addThis->prev = 0;
704  }
705  else {
706  TIXMLASSERT( lastChild == 0 );
707  firstChild = lastChild = addThis;
708 
709  addThis->prev = 0;
710  addThis->next = 0;
711  }
712  addThis->parent = this;
713  return addThis;
714 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
XMLNode * firstChild
Definition: tinyxml2.h:611
XMLNode * parent
Definition: tinyxml2.h:608
XMLNode * next
Definition: tinyxml2.h:615
XMLNode * lastChild
Definition: tinyxml2.h:612
XMLNode * prev
Definition: tinyxml2.h:614
const XMLNode* tinyxml2::XMLNode::LastChild ( ) const
inline

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

Definition at line 505 of file tinyxml2.h.

References lastChild.

Referenced by tinyxml2::XMLHandle::LastChild(), and tinyxml2::XMLConstHandle::LastChild().

505 { return lastChild; }
XMLNode * lastChild
Definition: tinyxml2.h:612
XMLNode* tinyxml2::XMLNode::LastChild ( )
inline

Definition at line 506 of file tinyxml2.h.

References LastChild().

Referenced by LastChild().

506 { return const_cast<XMLNode*>(const_cast<const XMLNode*>(this)->LastChild() ); }
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:505
XMLNode(XMLDocument *)
Definition: tinyxml2_imp.h:599
const XMLElement * XMLNode::LastChildElement ( const char *  value = 0) const
inline

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

Definition at line 755 of file tinyxml2_imp.h.

References lastChild, tinyxml2::XMLElement::Name(), prev, tinyxml2::XMLUtil::StringEqual(), tinyxml2::XMLElement::ToElement(), and value.

Referenced by tinyxml2::XMLHandle::LastChildElement(), and tinyxml2::XMLConstHandle::LastChildElement().

756 {
757  for( XMLNode* node=lastChild; node; node=node->prev ) {
758  XMLElement* element = node->ToElement();
759  if ( element ) {
760  if ( !value || XMLUtil::StringEqual( element->Name(), value ) ) {
761  return element;
762  }
763  }
764  }
765  return 0;
766 }
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:384
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:861
XMLNode * lastChild
Definition: tinyxml2.h:612
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:865
XMLNode * prev
Definition: tinyxml2.h:614
XMLElement* tinyxml2::XMLNode::LastChildElement ( const char *  _value = 0)
inline

Definition at line 512 of file tinyxml2.h.

References LastChildElement().

Referenced by LastChildElement().

512 { return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(_value) ); }
const XMLElement * LastChildElement(const char *value=0) const
Definition: tinyxml2_imp.h:755
friend class XMLElement
Definition: tinyxml2.h:451
XMLNode(XMLDocument *)
Definition: tinyxml2_imp.h:599
XMLNode* tinyxml2::XMLNode::LinkEndChild ( XMLNode addThis)
inline

Definition at line 535 of file tinyxml2.h.

References InsertEndChild().

535 { return InsertEndChild( addThis ); }
XMLNode * InsertEndChild(XMLNode *addThis)
Definition: tinyxml2_imp.h:669
const XMLNode* tinyxml2::XMLNode::NextSibling ( ) const
inline

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

Definition at line 523 of file tinyxml2.h.

References next.

Referenced by tinyxml2::XMLElement::Accept(), tinyxml2::XMLDocument::Accept(), tinyxml2::XMLHandle::NextSibling(), and tinyxml2::XMLConstHandle::NextSibling().

523 { return next; }
XMLNode * next
Definition: tinyxml2.h:615
XMLNode* tinyxml2::XMLNode::NextSibling ( )
inline

Definition at line 524 of file tinyxml2.h.

References next.

524 { return next; }
XMLNode * next
Definition: tinyxml2.h:615
const XMLElement * XMLNode::NextSiblingElement ( const char *  value = 0) const
inline

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

Definition at line 770 of file tinyxml2_imp.h.

References next, tinyxml2::XMLUtil::StringEqual(), and tinyxml2::XMLElement::ToElement().

Referenced by Antioch::XMLParser< NumericType >::find_element_with_attribute(), tinyxml2::XMLHandle::NextSiblingElement(), tinyxml2::XMLConstHandle::NextSiblingElement(), Antioch::XMLParser< NumericType >::read_thermodynamic_data_root(), and Antioch::XMLParser< NumericType >::where_is_k0().

771 {
772  for( XMLNode* element=this->next; element; element = element->next ) {
773  if ( element->ToElement()
774  && (!value || XMLUtil::StringEqual( value, element->Value() )))
775  {
776  return element->ToElement();
777  }
778  }
779  return 0;
780 }
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:384
XMLNode * next
Definition: tinyxml2.h:615
XMLElement* tinyxml2::XMLNode::NextSiblingElement ( const char *  _value = 0)
inline

Definition at line 528 of file tinyxml2.h.

References NextSiblingElement().

Referenced by NextSiblingElement().

528 { return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( _value ) ); }
friend class XMLElement
Definition: tinyxml2.h:451
const XMLElement * NextSiblingElement(const char *value=0) const
Get the next (right) sibling element of this node, with an opitionally supplied name.
Definition: tinyxml2_imp.h:770
XMLNode(XMLDocument *)
Definition: tinyxml2_imp.h:599
bool tinyxml2::XMLNode::NoChildren ( ) const
inline

Returns true if this node has no children.

Definition at line 493 of file tinyxml2.h.

References firstChild.

493 { return !firstChild; }
XMLNode * firstChild
Definition: tinyxml2.h:611
XMLNode& tinyxml2::XMLNode::operator= ( const XMLNode )
protected
const XMLNode* tinyxml2::XMLNode::Parent ( ) const
inline

Get the parent of this node on the DOM.

Definition at line 489 of file tinyxml2.h.

References parent.

489 { return parent; }
XMLNode * parent
Definition: tinyxml2.h:608
XMLNode* tinyxml2::XMLNode::Parent ( )
inline

Definition at line 490 of file tinyxml2.h.

References parent.

490 { return parent; }
XMLNode * parent
Definition: tinyxml2.h:608
char * XMLNode::ParseDeep ( char *  p,
StrPair parentEnd 
)
inlinevirtual

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

Definition at line 798 of file tinyxml2_imp.h.

References tinyxml2::XMLElement::CLOSING, tinyxml2::XMLElement::ClosingType(), DELETE_NODE, document, tinyxml2::StrPair::Empty(), tinyxml2::XMLDocument::Error(), tinyxml2::StrPair::GetStr(), tinyxml2::XMLDocument::Identify(), InsertEndChild(), tinyxml2::XMLElement::OPEN, ParseDeep(), tinyxml2::XMLDocument::SetError(), tinyxml2::XMLUtil::StringEqual(), ToElement(), Value(), value, tinyxml2::XML_ERROR_MISMATCHED_ELEMENT, and tinyxml2::XML_ERROR_PARSING.

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

799 {
800  // This is a recursive method, but thinking about it "at the current level"
801  // it is a pretty simple flat list:
802  // <foo/>
803  // <!-- comment -->
804  //
805  // With a special case:
806  // <foo>
807  // </foo>
808  // <!-- comment -->
809  //
810  // Where the closing element (/foo) *must* be the next thing after the opening
811  // element, and the names must match. BUT the tricky bit is that the closing
812  // element will be read by the child.
813  //
814  // 'endTag' is the end tag for this node, it is returned by a call to a child.
815  // 'parentEnd' is the end tag for the parent, which is filled in and returned.
816 
817  while( p && *p ) {
818  XMLNode* node = 0;
819 
820  p = document->Identify( p, &node );
821  if ( p == 0 || node == 0 ) {
822  break;
823  }
824 
825  StrPair endTag;
826  p = node->ParseDeep( p, &endTag );
827  if ( !p ) {
828  DELETE_NODE( node );
829  node = 0;
830  if ( !document->Error() ) {
832  }
833  break;
834  }
835 
836  // We read the end tag. Return it to the parent.
837  if ( node->ToElement() && node->ToElement()->ClosingType() == XMLElement::CLOSING ) {
838  if ( parentEnd ) {
839  *parentEnd = static_cast<XMLElement*>(node)->value;
840  }
841  DELETE_NODE( node );
842  return p;
843  }
844 
845  // Handle an end tag returned to this level.
846  // And handle a bunch of annoying errors.
847  XMLElement* ele = node->ToElement();
848  if ( ele ) {
849  if ( endTag.Empty() && ele->ClosingType() == XMLElement::OPEN ) {
851  p = 0;
852  }
853  else if ( !endTag.Empty() && ele->ClosingType() != XMLElement::OPEN ) {
855  p = 0;
856  }
857  else if ( !endTag.Empty() ) {
858  if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() )) {
860  p = 0;
861  }
862  }
863  }
864  if ( p == 0 ) {
865  DELETE_NODE( node );
866  node = 0;
867  }
868  if ( node ) {
869  this->InsertEndChild( node );
870  }
871  }
872  return 0;
873 }
#define DELETE_NODE(node)
Definition: tinyxml2_imp.h:56
const char * GetStr()
Definition: tinyxml2_imp.h:195
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:384
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1195
XMLDocument * document
Definition: tinyxml2.h:607
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:459
XMLNode * InsertEndChild(XMLNode *addThis)
Definition: tinyxml2_imp.h:669
void SetError(int error, const char *str1, const char *str2)
bool Empty() const
Definition: tinyxml2.h:143
virtual char * ParseDeep(char *, StrPair *)
Definition: tinyxml2_imp.h:798
int ClosingType() const
Definition: tinyxml2.h:1025
const char * Value() const
Definition: tinyxml2.h:482
char * Identify(char *p, XMLNode **node)
Definition: tinyxml2_imp.h:505
const XMLNode* tinyxml2::XMLNode::PreviousSibling ( ) const
inline

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

Definition at line 515 of file tinyxml2.h.

References prev.

Referenced by tinyxml2::XMLHandle::PreviousSibling(), and tinyxml2::XMLConstHandle::PreviousSibling().

515 { return prev; }
XMLNode * prev
Definition: tinyxml2.h:614
XMLNode* tinyxml2::XMLNode::PreviousSibling ( )
inline

Definition at line 516 of file tinyxml2.h.

References prev.

516 { return prev; }
XMLNode * prev
Definition: tinyxml2.h:614
const XMLElement * XMLNode::PreviousSiblingElement ( const char *  value = 0) const
inline

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

Definition at line 784 of file tinyxml2_imp.h.

References prev, tinyxml2::XMLUtil::StringEqual(), and tinyxml2::XMLElement::ToElement().

Referenced by tinyxml2::XMLHandle::PreviousSiblingElement(), and tinyxml2::XMLConstHandle::PreviousSiblingElement().

785 {
786  for( XMLNode* element=this->prev; element; element = element->prev ) {
787  if ( element->ToElement()
788  && (!value || XMLUtil::StringEqual( value, element->Value() )))
789  {
790  return element->ToElement();
791  }
792  }
793  return 0;
794 }
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:384
XMLNode * prev
Definition: tinyxml2.h:614
XMLElement* tinyxml2::XMLNode::PreviousSiblingElement ( const char *  _value = 0)
inline

Definition at line 520 of file tinyxml2.h.

References PreviousSiblingElement().

Referenced by PreviousSiblingElement().

520 { return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( _value ) ); }
const XMLElement * PreviousSiblingElement(const char *value=0) const
Get the previous (left) sibling element of this node, with an opitionally supplied name...
Definition: tinyxml2_imp.h:784
friend class XMLElement
Definition: tinyxml2.h:451
XMLNode(XMLDocument *)
Definition: tinyxml2_imp.h:599
void XMLNode::SetValue ( const char *  val,
bool  staticMem = false 
)
inline

Set the Value of an XML node.

See also
Value()

Definition at line 619 of file tinyxml2_imp.h.

References tinyxml2::StrPair::SetInternedStr(), tinyxml2::StrPair::SetStr(), and value.

Referenced by tinyxml2::XMLDocument::NewComment(), tinyxml2::XMLDocument::NewDeclaration(), tinyxml2::XMLDocument::NewText(), tinyxml2::XMLDocument::NewUnknown(), and tinyxml2::XMLElement::SetName().

620 {
621  if ( staticMem )
622  value.SetInternedStr( str );
623  else
624  value.SetStr( str );
625 }
void SetStr(const char *str, int flags=0)
Definition: tinyxml2_imp.h:108
void SetInternedStr(const char *str)
Definition: tinyxml2.h:145
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::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, and tinyxml2::XMLText.

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::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, and tinyxml2::XMLText.

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

Safely cast to a Comment, or null.

Reimplemented in tinyxml2::XMLComment.

Definition at line 461 of file tinyxml2.h.

Referenced by tinyxml2::XMLComment::ShallowEqual().

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

Reimplemented in tinyxml2::XMLComment.

Definition at line 468 of file tinyxml2.h.

468 { return 0; }
virtual XMLDeclaration* tinyxml2::XMLNode::ToDeclaration ( )
inlinevirtual

Safely cast to a Declaration, or null.

Reimplemented in tinyxml2::XMLDeclaration.

Definition at line 463 of file tinyxml2.h.

Referenced by tinyxml2::XMLDeclaration::ShallowEqual(), tinyxml2::XMLHandle::ToDeclaration(), and tinyxml2::XMLConstHandle::ToDeclaration().

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

Reimplemented in tinyxml2::XMLDeclaration.

Definition at line 470 of file tinyxml2.h.

470 { return 0; }
virtual XMLDocument* tinyxml2::XMLNode::ToDocument ( )
inlinevirtual

Safely cast to a Document, or null.

Reimplemented in tinyxml2::XMLDocument.

Definition at line 462 of file tinyxml2.h.

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

Reimplemented in tinyxml2::XMLDocument.

Definition at line 469 of file tinyxml2.h.

469 { return 0; }
virtual XMLElement* tinyxml2::XMLNode::ToElement ( )
inlinevirtual

Safely cast to an Element, or null.

Reimplemented in tinyxml2::XMLElement.

Definition at line 459 of file tinyxml2.h.

Referenced by ParseDeep(), tinyxml2::XMLElement::ShallowEqual(), tinyxml2::XMLHandle::ToElement(), and tinyxml2::XMLConstHandle::ToElement().

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

Reimplemented in tinyxml2::XMLElement.

Definition at line 466 of file tinyxml2.h.

466 { return 0; }
virtual XMLText* tinyxml2::XMLNode::ToText ( )
inlinevirtual
virtual const XMLText* tinyxml2::XMLNode::ToText ( ) const
inlinevirtual

Reimplemented in tinyxml2::XMLText.

Definition at line 467 of file tinyxml2.h.

467 { return 0; }
virtual XMLUnknown* tinyxml2::XMLNode::ToUnknown ( )
inlinevirtual

Safely cast to an Unknown, or null.

Reimplemented in tinyxml2::XMLUnknown.

Definition at line 464 of file tinyxml2.h.

Referenced by tinyxml2::XMLUnknown::ShallowEqual(), tinyxml2::XMLHandle::ToUnknown(), and tinyxml2::XMLConstHandle::ToUnknown().

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

Reimplemented in tinyxml2::XMLUnknown.

Definition at line 471 of file tinyxml2.h.

471 { return 0; }
void XMLNode::Unlink ( XMLNode child)
inlineprivate

Definition at line 642 of file tinyxml2_imp.h.

References firstChild, lastChild, next, parent, prev, and TIXMLASSERT.

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

643 {
644  TIXMLASSERT( child->parent == this );
645  if ( child == firstChild )
647  if ( child == lastChild )
649 
650  if ( child->prev ) {
651  child->prev->next = child->next;
652  }
653  if ( child->next ) {
654  child->next->prev = child->prev;
655  }
656  child->parent = 0;
657 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
XMLNode * firstChild
Definition: tinyxml2.h:611
XMLNode * parent
Definition: tinyxml2.h:608
XMLNode * next
Definition: tinyxml2.h:615
XMLNode * lastChild
Definition: tinyxml2.h:612
XMLNode * prev
Definition: tinyxml2.h:614
const char* tinyxml2::XMLNode::Value ( ) const
inline

Friends And Related Function Documentation

friend class XMLDocument
friend

Definition at line 450 of file tinyxml2.h.

friend class XMLElement
friend

Definition at line 451 of file tinyxml2.h.

Member Data Documentation

XMLDocument* tinyxml2::XMLNode::document
protected
XMLNode* tinyxml2::XMLNode::firstChild
protected
XMLNode* tinyxml2::XMLNode::lastChild
protected
MemPool* tinyxml2::XMLNode::memPool
private

Definition at line 618 of file tinyxml2.h.

Referenced by tinyxml2::XMLDocument::Identify().

XMLNode* tinyxml2::XMLNode::next
protected
XMLNode* tinyxml2::XMLNode::parent
protected
XMLNode* tinyxml2::XMLNode::prev
protected
StrPair tinyxml2::XMLNode::value
mutableprotected

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

Generated on Thu Jul 7 2016 11:09:53 for antioch-0.4.0 by  doxygen 1.8.8