Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends

TiXmlNode Class Reference

#include <tinyxml.h>

Inheritance diagram for TiXmlNode:
Inheritance graph
[legend]
Collaboration diagram for TiXmlNode:
Collaboration graph
[legend]

List of all members.

Public Types

Public Member Functions

Protected Member Functions

Protected Attributes

Private Member Functions

Friends


Detailed Description

The parent class for everything in the Document Object Model. (Except for attributes). Nodes have siblings, a parent, and children. A node can be in a document, or stand on its own. The type of a TiXmlNode can be queried, and it can be cast to its more defined type.


Member Enumeration Documentation

The types of XML nodes supported by TinyXml. (All the unsupported types are picked up by UNKNOWN.)

Enumerator:
DOCUMENT 
ELEMENT 
COMMENT 
UNKNOWN 
TEXT 
DECLARATION 
TYPECOUNT 

Constructor & Destructor Documentation

TiXmlNode::~TiXmlNode (  )  [virtual]

References firstChild, and next.

TiXmlNode::TiXmlNode ( NodeType  _type  )  [protected]

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

TiXmlNode::TiXmlNode ( const TiXmlNode  )  [private]

Member Function Documentation

const char* TiXmlNode::Value (  )  const [inline]

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

		Document:	filename of the xml file
		Element:	name of the element
		Comment:	the comment text
		Unknown:	the tag contents
		Text:		the text string
		

The subclasses will wrap this function.

References TiXmlString::c_str(), and value.

Referenced by TiXmlElement::Clone(), CRusCorpXmlFile::CreateGraTable(), GetCWBFormattedStringRecursive(), GetTextFromXMLRecursive(), CConcXml::ReadMorphXmlFileIntoGraTable(), and ReadXmlField().

Here is the call graph for this function:

Here is the caller graph for this function:

void TiXmlNode::SetValue ( const char *  _value  )  [inline]

Changes the value of the node. Defined as:

		Document:	filename of the xml file
		Element:	name of the element
		Comment:	the comment text
		Unknown:	the tag contents
		Text:		the text string
		

References value.

Referenced by CopyTo(), and TiXmlText::TiXmlText().

Here is the caller graph for this function:

void TiXmlNode::Clear (  ) 

Delete all the children of this node. Does not affect 'this'.

References firstChild, lastChild, and next.

Referenced by TiXmlElement::ClearThis(), CRusCorpXmlFile::CreateGraTable(), TiXmlDocument::LoadFile(), TiXmlDeclaration::operator=(), TiXmlComment::operator=(), and TiXmlDocument::operator=().

Here is the caller graph for this function:

TiXmlNode* TiXmlNode::Parent (  )  const [inline]

One step up the DOM.

References parent.

TiXmlNode* TiXmlNode::FirstChild (  )  const [inline]

The first child of this node. Will be null if there are no children.

References firstChild.

Referenced by TiXmlHandle::Child(), TiXmlHandle::FirstChild(), FirstChildElement(), GetCWBFormattedStringRecursive(), GetTextFromXMLRecursive(), IterateChildren(), TiXmlDocument::Print(), ReadXmlField(), and TiXmlDocument::StreamOut().

Here is the caller graph for this function:

TiXmlNode * TiXmlNode::FirstChild ( const char *  value  )  const

The first child of this node with the matching 'value'. Will be null if none found.

References firstChild, next, SValue(), and TIXML_STRING.

Here is the call graph for this function:

TiXmlNode* TiXmlNode::LastChild (  )  const [inline]

References lastChild.

TiXmlNode * TiXmlNode::LastChild ( const char *  value  )  const

The last child of this node. Will be null if there are no children.

References lastChild, prev, SValue(), and TIXML_STRING.

Here is the call graph for this function:

TiXmlNode * TiXmlNode::IterateChildren ( TiXmlNode previous  )  const

The last child of this node matching 'value'. Will be null if there are no children.

An alternate way to walk the children of a node. One way to iterate over nodes is:

			for( child = parent->FirstChild(); child; child = child->NextSibling() )
		

IterateChildren does the same thing with the syntax:

			child = 0;
			while( child = parent->IterateChildren( child ) )
		

IterateChildren takes the previous child as input and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done.

References FirstChild(), NextSibling(), and parent.

Here is the call graph for this function:

TiXmlNode * TiXmlNode::IterateChildren ( const char *  value,
TiXmlNode previous 
) const

This flavor of IterateChildren searches for children with a particular 'value'.

References FirstChild(), NextSibling(), and parent.

Here is the call graph for this function:

TiXmlNode * TiXmlNode::InsertEndChild ( const TiXmlNode addThis  ) 

Add a new node related to this. Adds a child past the LastChild. Returns a pointer to the new object or NULL if an error occured.

References Clone(), and LinkEndChild().

Here is the call graph for this function:

TiXmlNode * TiXmlNode::LinkEndChild ( TiXmlNode addThis  ) 

Add a new node related to this. Adds a child past the LastChild.

NOTE: the node to be added is passed by pointer, and will be henceforth owned (and deleted) by tinyXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions.

See also:
InsertEndChild

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

Referenced by TiXmlDocument::CopyTo(), TiXmlElement::CopyTo(), InsertEndChild(), TiXmlDocument::Parse(), and TiXmlElement::ReadValue().

Here is the caller graph for this function:

TiXmlNode * TiXmlNode::InsertBeforeChild ( TiXmlNode beforeThis,
const TiXmlNode addThis 
)

Add a new node related to this. Adds a child before the specified child. Returns a pointer to the new object or NULL if an error occured.

References Clone(), firstChild, next, parent, and prev.

Here is the call graph for this function:

TiXmlNode * TiXmlNode::InsertAfterChild ( TiXmlNode afterThis,
const TiXmlNode addThis 
)

Add a new node related to this. Adds a child after the specified child. Returns a pointer to the new object or NULL if an error occured.

References Clone(), lastChild, next, parent, and prev.

Here is the call graph for this function:

TiXmlNode * TiXmlNode::ReplaceChild ( TiXmlNode replaceThis,
const TiXmlNode withThis 
)

Replace a child of this node. Returns a pointer to the new object or NULL if an error occured.

References Clone(), firstChild, lastChild, next, parent, and prev.

Here is the call graph for this function:

bool TiXmlNode::RemoveChild ( TiXmlNode removeThis  ) 

Delete a child of this node.

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

TiXmlNode* TiXmlNode::PreviousSibling (  )  const [inline]

Navigate to a sibling node.

References prev.

TiXmlNode * TiXmlNode::PreviousSibling ( const char *  _value  )  const

Navigate to a sibling node.

References prev, SValue(), and TIXML_STRING.

Here is the call graph for this function:

TiXmlNode* TiXmlNode::NextSibling (  )  const [inline]
TiXmlNode * TiXmlNode::NextSibling ( const char *  _value  )  const

Navigate to a sibling node with the given 'value'.

References next, SValue(), and TIXML_STRING.

Here is the call graph for this function:

TiXmlElement * TiXmlNode::NextSiblingElement (  )  const

Convenience function to get through elements. Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.

References NextSibling(), and ToElement().

Referenced by TiXmlHandle::ChildElement(), CRusCorpXmlFile::CreateGraTable(), CRusCorpXmlFile::PrintDisambiguatedXmlNodes(), and CConcXml::ReadMorphXmlFileIntoGraTable().

Here is the call graph for this function:

Here is the caller graph for this function:

TiXmlElement * TiXmlNode::NextSiblingElement ( const char *  _value  )  const

Convenience function to get through elements. Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.

References NextSibling(), and ToElement().

Here is the call graph for this function:

TiXmlElement * TiXmlNode::FirstChildElement (  )  const

Convenience function to get through elements.

References FirstChild(), NextSibling(), and ToElement().

Referenced by TiXmlHandle::ChildElement(), CRusCorpXmlFile::CreateGraTable(), TiXmlHandle::FirstChildElement(), CRusCorpXmlFile::PrintDisambiguatedXmlNodes(), CConcXml::ReadMorphXmlFileIntoGraTable(), and TiXmlDocument::RootElement().

Here is the call graph for this function:

Here is the caller graph for this function:

TiXmlElement * TiXmlNode::FirstChildElement ( const char *  value  )  const

Convenience function to get through elements.

References FirstChild(), NextSibling(), and ToElement().

Here is the call graph for this function:

virtual int TiXmlNode::Type (  )  const [inline, virtual]

Query the type (as an enumerated value, above) of this node. The possible types are: DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, and DECLARATION.

References type.

Referenced by GetCWBFormattedStringRecursive(), and GetTextFromXMLRecursive().

Here is the caller graph for this function:

TiXmlDocument * TiXmlNode::GetDocument (  )  const

Return a pointer to the Document this node lives in. Returns null if not in a document.

References parent, and ToDocument().

Referenced by Identify(), TiXmlDeclaration::Parse(), TiXmlComment::Parse(), TiXmlUnknown::Parse(), TiXmlElement::Parse(), TiXmlElement::ReadValue(), and TiXmlElement::SetAttribute().

Here is the call graph for this function:

Here is the caller graph for this function:

bool TiXmlNode::NoChildren (  )  const [inline]

Returns true if this node has no children.

References firstChild.

TiXmlDocument* TiXmlNode::ToDocument (  )  const [inline]

Cast to a more defined type. Will return null not of the requested type.

References DOCUMENT, and type.

Referenced by GetDocument().

Here is the caller graph for this function:

TiXmlElement* TiXmlNode::ToElement (  )  const [inline]

Cast to a more defined type. Will return null not of the requested type.

References ELEMENT, and type.

Referenced by TiXmlHandle::Element(), FirstChildElement(), GetCWBFormattedStringRecursive(), CConcXml::GetTextAreaElements(), NextSiblingElement(), and TiXmlDocument::StreamOut().

Here is the caller graph for this function:

TiXmlComment* TiXmlNode::ToComment (  )  const [inline]

Cast to a more defined type. Will return null not of the requested type.

References COMMENT, and type.

TiXmlUnknown* TiXmlNode::ToUnknown (  )  const [inline]

Cast to a more defined type. Will return null not of the requested type.

References type, and UNKNOWN.

Referenced by TiXmlHandle::Unknown().

Here is the caller graph for this function:

TiXmlText* TiXmlNode::ToText (  )  const [inline]

Cast to a more defined type. Will return null not of the requested type.

References TEXT, and type.

Referenced by TiXmlElement::Print(), and TiXmlHandle::Text().

Here is the caller graph for this function:

TiXmlDeclaration* TiXmlNode::ToDeclaration (  )  const [inline]

Cast to a more defined type. Will return null not of the requested type.

References DECLARATION, and type.

Referenced by TiXmlDocument::Parse().

Here is the caller graph for this function:

virtual TiXmlNode* TiXmlNode::Clone (  )  const [pure virtual]

Create an exact duplicate of this node and return it. The memory must be deleted by the caller.

Implemented in TiXmlElement, TiXmlComment, TiXmlText, TiXmlDeclaration, TiXmlUnknown, and TiXmlDocument.

Referenced by TiXmlDocument::CopyTo(), TiXmlElement::CopyTo(), InsertAfterChild(), InsertBeforeChild(), InsertEndChild(), and ReplaceChild().

Here is the caller graph for this function:

void TiXmlNode::CopyTo ( TiXmlNode target  )  const [protected]

References TiXmlString::c_str(), SetValue(), TiXmlBase::userData, and value.

Here is the call graph for this function:

TiXmlNode * TiXmlNode::Identify ( const char *  start,
TiXmlEncoding  encoding 
) [protected]
const TiXmlString& TiXmlNode::SValue (  )  const [inline, protected]

References value.

Referenced by FirstChild(), LastChild(), NextSibling(), and PreviousSibling().

Here is the caller graph for this function:

void TiXmlNode::operator= ( const TiXmlNode base  )  [private]

Friends And Related Function Documentation

friend class TiXmlDocument [friend]

Reimplemented from TiXmlBase.

friend class TiXmlElement [friend]

Reimplemented from TiXmlBase.

Reimplemented in TiXmlText.

Referenced by Identify().

TiXmlOutStream& operator<< ( TiXmlOutStream out,
const TiXmlNode base 
) [friend]

Member Data Documentation

TiXmlNode* TiXmlNode::prev [protected]
TiXmlNode* TiXmlNode::next [protected]

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