class TiXmlNode
|
The parent class for everything in the Document Object Model. More... |
|
|
Public Types
- enum NodeType { DOCUMENT,
ELEMENT,
COMMENT,
UNKNOWN,
TEXT,
DECLARATION,
TYPECOUNT
}
Public Methods
- friend std::istream& operator >> (std::istream& in, TiXmlNode& base)
- friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base)
- friend std::string& operator<< (std::string& out, const TiXmlNode& base )
- friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base)
- virtual ~TiXmlNode ()
- const char * Value () const
- const std::string& ValueStr () const
- void SetValue (const char * _value)
- void SetValue ( const std::string& _value )
- void Clear ()
- TiXmlNode* Parent ()
- const TiXmlNode* Parent () const
- const TiXmlNode* FirstChild () const
- TiXmlNode* FirstChild ()
- const TiXmlNode* FirstChild ( const char * value ) const
- TiXmlNode* FirstChild ( const char * value )
- const TiXmlNode* LastChild () const
- TiXmlNode* LastChild ()
- const TiXmlNode* LastChild ( const char * value ) const
- TiXmlNode* LastChild ( const char * value )
- const TiXmlNode* FirstChild ( const std::string& _value ) const
- TiXmlNode* FirstChild ( const std::string& _value )
- const TiXmlNode* LastChild ( const std::string& _value ) const
- TiXmlNode* LastChild ( const std::string& _value )
- const TiXmlNode* IterateChildren ( const TiXmlNode* previous ) const
- TiXmlNode* IterateChildren ( TiXmlNode* previous )
- const TiXmlNode* IterateChildren ( const char * value, const TiXmlNode* previous ) const
- TiXmlNode* IterateChildren ( const char * value, TiXmlNode* previous )
- const TiXmlNode* IterateChildren ( const std::string& _value, const TiXmlNode* previous ) const
- TiXmlNode* IterateChildren ( const std::string& _value, TiXmlNode* previous )
- TiXmlNode* InsertEndChild ( const TiXmlNode& addThis )
- TiXmlNode* LinkEndChild ( TiXmlNode* addThis )
- TiXmlNode* InsertBeforeChild ( TiXmlNode* beforeThis, const TiXmlNode& addThis )
- TiXmlNode* InsertAfterChild ( TiXmlNode* afterThis, const TiXmlNode& addThis )
- TiXmlNode* ReplaceChild ( TiXmlNode* replaceThis, const TiXmlNode& withThis )
- bool RemoveChild ( TiXmlNode* removeThis, bool del = true )
- const TiXmlNode* PreviousSibling () const
- TiXmlNode* PreviousSibling ()
- const TiXmlNode* PreviousSibling ( const char * ) const
- TiXmlNode* PreviousSibling ( const char * )
- const TiXmlNode* PreviousSibling ( const std::string& _value ) const
- TiXmlNode* PreviousSibling ( const std::string& _value )
- const TiXmlNode* NextSibling ( const std::string& _value) const
- TiXmlNode* NextSibling ( const std::string& _value)
- const TiXmlNode* NextSibling () const
- TiXmlNode* NextSibling ()
- const TiXmlNode* NextSibling ( const char * ) const
- TiXmlNode* NextSibling ( const char * )
- const TiXmlElement* NextSiblingElement () const
- TiXmlElement* NextSiblingElement ()
- const TiXmlElement* NextSiblingElement ( const char * ) const
- TiXmlElement* NextSiblingElement ( const char * )
- const TiXmlElement* NextSiblingElement ( const std::string& _value) const
- TiXmlElement* NextSiblingElement ( const std::string& _value)
- const TiXmlElement* FirstChildElement () const
- TiXmlElement* FirstChildElement ()
- const TiXmlElement* FirstChildElement ( const char * value ) const
- TiXmlElement* FirstChildElement ( const char * value )
- const TiXmlElement* FirstChildElement ( const std::string& _value ) const
- TiXmlElement* FirstChildElement ( const std::string& _value )
- int Type () const
- const TiXmlDocument* GetDocument () const
- TiXmlDocument* GetDocument ()
- bool NoChildren () const
- virtual const TiXmlDocument* ToDocument () const
- virtual const TiXmlElement* ToElement () const
- virtual const TiXmlComment* ToComment () const
- virtual const TiXmlUnknown* ToUnknown () const
- virtual const TiXmlText* ToText () const
- virtual const TiXmlDeclaration* ToDeclaration () const
- virtual TiXmlDocument* ToDocument ()
- virtual TiXmlElement* ToElement ()
- virtual TiXmlComment* ToComment ()
- virtual TiXmlUnknown* ToUnknown ()
- virtual TiXmlText* ToText ()
- virtual TiXmlDeclaration* ToDeclaration ()
- virtual TiXmlNode* Clone () const
Protected Methods
- TiXmlNode ( NodeType _type )
- void CopyTo ( TiXmlNode* target ) const
- virtual void StreamIn ( TIXML_ISTREAM* in, TIXML_STRING* tag )
- TiXmlNode* Identify ( const char* start, TiXmlEncoding encoding )
Protected Members
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.
friend std::istream& operator >> (std::istream& in, TiXmlNode& base)
| operator >> |
An input stream operator, for every class. Tolerant of newlines and
formatting, but doesn't expect them.
friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base)
| operator<< |
An output stream operator, for every class. Note that this outputs
without any newlines or formatting, as opposed to Print(), which
includes tabs and new lines.
The operator<< and operator>> are not completely symmetric. Writing
a node to a stream is very well defined. You'll get a nice stream
of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) If you create
a TiXmlElement (for example) and read that from an input stream,
the text needs to define an element or junk will result. This is
true of all input streams, but it's worth keeping in mind.
A TiXmlDocument will read nodes until it reads a root element, and
all the children of that root element.
friend std::string& operator<< (std::string& out, const TiXmlNode& base )
| operator<< |
friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base)
| operator<< |
enum NodeType { DOCUMENT,
ELEMENT,
COMMENT,
UNKNOWN,
TEXT,
DECLARATION,
TYPECOUNT
}
| NodeType |
The types of XML nodes supported by TinyXml. (All the
unsupported types are picked up by UNKNOWN.)
[virtual]
const char * Value ()
| Value |
[const]
The meaning of 'value' changes for the specific type of
TiXmlNode.
@verbatim
Document: filename of the xml file
Element: name of the element
Comment: the comment text
Unknown: the tag contents
Text: the text string
@endverbatim
The subclasses will wrap this function.
const std::string& ValueStr ()
| ValueStr |
[const]
Return Value() as a std::string. If you only use STL,
this is more efficient than calling Value().
Only available in STL mode.
void SetValue (const char * _value)
| SetValue |
Changes the value of the node. Defined as:
@verbatim
Document: filename of the xml file
Element: name of the element
Comment: the comment text
Unknown: the tag contents
Text: the text string
@endverbatim
void SetValue ( const std::string& _value )
| SetValue |
TiXmlNode* Parent ()
| Parent |
const TiXmlNode* Parent ()
| Parent |
[const]
const TiXmlNode* FirstChild ()
| FirstChild |
[const]
TiXmlNode* FirstChild ()
| FirstChild |
const TiXmlNode* FirstChild ( const char * value )
| FirstChild |
[const]
TiXmlNode* FirstChild ( const char * value )
| FirstChild |
const TiXmlNode* LastChild ()
| LastChild |
[const]
TiXmlNode* LastChild ()
| LastChild |
const TiXmlNode* LastChild ( const char * value )
| LastChild |
[const]
TiXmlNode* LastChild ( const char * value )
| LastChild |
const TiXmlNode* FirstChild ( const std::string& _value )
| FirstChild |
[const]
TiXmlNode* FirstChild ( const std::string& _value )
| FirstChild |
const TiXmlNode* LastChild ( const std::string& _value )
| LastChild |
[const]
TiXmlNode* LastChild ( const std::string& _value )
| LastChild |
const TiXmlNode* IterateChildren ( const TiXmlNode* previous )
| IterateChildren |
[const]
An alternate way to walk the children of a node.
One way to iterate over nodes is:
@verbatim
for( child = parent->FirstChild(); child; child = child->NextSibling() )
@endverbatim
IterateChildren does the same thing with the syntax:
@verbatim
child = 0;
while( child = parent->IterateChildren( child ) )
@endverbatim
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.
TiXmlNode* IterateChildren ( TiXmlNode* previous )
| IterateChildren |
const TiXmlNode* IterateChildren ( const char * value, const TiXmlNode* previous )
| IterateChildren |
[const]
TiXmlNode* IterateChildren ( const char * value, TiXmlNode* previous )
| IterateChildren |
const TiXmlNode* IterateChildren ( const std::string& _value, const TiXmlNode* previous )
| IterateChildren |
[const]
TiXmlNode* IterateChildren ( const std::string& _value, TiXmlNode* previous )
| IterateChildren |
TiXmlNode* InsertEndChild ( const TiXmlNode& addThis )
| InsertEndChild |
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.
TiXmlNode* LinkEndChild ( TiXmlNode* addThis )
| LinkEndChild |
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.
@sa InsertEndChild
TiXmlNode* InsertBeforeChild ( TiXmlNode* beforeThis, const TiXmlNode& addThis )
| InsertBeforeChild |
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.
TiXmlNode* InsertAfterChild ( TiXmlNode* afterThis, const TiXmlNode& addThis )
| InsertAfterChild |
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.
TiXmlNode* ReplaceChild ( TiXmlNode* replaceThis, const TiXmlNode& withThis )
| ReplaceChild |
Replace a child of this node.
Returns a pointer to the new object or NULL if an error occured.
bool RemoveChild ( TiXmlNode* removeThis, bool del = true )
| RemoveChild |
const TiXmlNode* PreviousSibling ()
| PreviousSibling |
[const]
TiXmlNode* PreviousSibling ()
| PreviousSibling |
const TiXmlNode* PreviousSibling ( const char * )
| PreviousSibling |
[const]
TiXmlNode* PreviousSibling ( const char * )
| PreviousSibling |
const TiXmlNode* PreviousSibling ( const std::string& _value )
| PreviousSibling |
[const]
TiXmlNode* PreviousSibling ( const std::string& _value )
| PreviousSibling |
const TiXmlNode* NextSibling ( const std::string& _value)
| NextSibling |
[const]
TiXmlNode* NextSibling ( const std::string& _value)
| NextSibling |
const TiXmlNode* NextSibling ()
| NextSibling |
[const]
TiXmlNode* NextSibling ()
| NextSibling |
const TiXmlNode* NextSibling ( const char * )
| NextSibling |
[const]
TiXmlNode* NextSibling ( const char * )
| NextSibling |
const TiXmlElement* NextSiblingElement ()
| 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.
TiXmlElement* NextSiblingElement ()
| NextSiblingElement |
const TiXmlElement* NextSiblingElement ( const char * )
| 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.
TiXmlElement* NextSiblingElement ( const char * )
| NextSiblingElement |
const TiXmlElement* NextSiblingElement ( const std::string& _value)
| NextSiblingElement |
[const]
TiXmlElement* NextSiblingElement ( const std::string& _value)
| NextSiblingElement |
const TiXmlElement* FirstChildElement ()
| FirstChildElement |
[const]
TiXmlElement* FirstChildElement ()
| FirstChildElement |
const TiXmlElement* FirstChildElement ( const char * value )
| FirstChildElement |
[const]
TiXmlElement* FirstChildElement ( const char * value )
| FirstChildElement |
const TiXmlElement* FirstChildElement ( const std::string& _value )
| FirstChildElement |
[const]
TiXmlElement* FirstChildElement ( const std::string& _value )
| FirstChildElement |
[const]
Query the type (as an enumerated value, above) of this node.
The possible types are: DOCUMENT, ELEMENT, COMMENT,
UNKNOWN, TEXT, and DECLARATION.
const TiXmlDocument* GetDocument ()
| GetDocument |
[const]
Return a pointer to the Document this node lives in.
Returns null if not in a document.
TiXmlDocument* GetDocument ()
| GetDocument |
bool NoChildren ()
| NoChildren |
[const]
const TiXmlDocument* ToDocument ()
| ToDocument |
[const virtual]
const TiXmlElement* ToElement ()
| ToElement |
[const virtual]
const TiXmlComment* ToComment ()
| ToComment |
[const virtual]
const TiXmlUnknown* ToUnknown ()
| ToUnknown |
[const virtual]
const TiXmlText* ToText ()
| ToText |
[const virtual]
const TiXmlDeclaration* ToDeclaration ()
| ToDeclaration |
[const virtual]
TiXmlDocument* ToDocument ()
| ToDocument |
[virtual]
TiXmlElement* ToElement ()
| ToElement |
[virtual]
TiXmlComment* ToComment ()
| ToComment |
[virtual]
TiXmlUnknown* ToUnknown ()
| ToUnknown |
[virtual]
TiXmlText* ToText ()
| ToText |
[virtual]
TiXmlDeclaration* ToDeclaration ()
| ToDeclaration |
[virtual]
TiXmlNode* Clone ()
| Clone |
[const pure virtual]
Create an exact duplicate of this node and return it. The memory must be deleted
by the caller.
TiXmlNode ( NodeType _type )
| TiXmlNode |
[protected]
void CopyTo ( TiXmlNode* target )
| CopyTo |
[protected const]
void StreamIn ( TIXML_ISTREAM* in, TIXML_STRING* tag )
| StreamIn |
[protected pure virtual]
TiXmlNode* Identify ( const char* start, TiXmlEncoding encoding )
| Identify |
[protected]
[protected]
[protected]
TiXmlNode* firstChild
| firstChild |
[protected]
TiXmlNode* lastChild
| lastChild |
[protected]
[protected]
[protected]
[protected]
Generated by: paulc on bussard on Mon Mar 8 12:18:15 2010, using kdoc 2.0a54. |