Interior node. More...
#include <XmlElement.h>
Public Member Functions | |
XmlElement (const XmlElement &) | |
virtual String | Name () const |
void | operator= (const XmlElement &base) |
XmlElementPtr | ChildElement (const String &value, int index) |
XmlElementPtr | ChildElement (int index) |
XmlAttributePtr | Attribute (const String &name) const |
XmlAttributePtr | Attribute (int index) const |
void | SetAttribute (const String &name, const String &_value) |
void | SetAttribute (const String &name, int val) |
void | SetAttribute (const String &name, double value) |
void | RemoveAttribute (const String &name) |
XmlAttributeCollectionPtr | Attributes () |
virtual StringPtr | InnerText () const |
virtual XmlNodePtr | Clone () const |
Creates a new Element and returns it - the returned element is a copy. | |
virtual XmlElementPtr | ToElement () const |
Cast to a more defined type. Will return null not of the requested type. | |
virtual StringPtr | InnerXml () const |
virtual StringPtr | ToString () const |
virtual void | WriteTo (TextWriter &writer) const |
virtual void | ValidateMem () const |
virtual void | CheckMem () const |
Static Public Member Functions | |
static XmlElementPtr | CreateElement (const String &name) |
Protected Member Functions | |
const char * | ReadValue (const char *in, XmlParsingData *prevData, XmlEncoding encoding) |
void | ClearThis () |
void | CopyTo (XmlElement &target) const |
virtual const char * | _Parse (const char *p, XmlParsingData *data, XmlEncoding encoding) |
XmlElement (const String &in_value) | |
Construct an element. | |
Protected Attributes | |
String | m_name |
XmlAttributeCollectionPtr | m_attribs |
Friends | |
class | XmlNode |
class | XmlText |
class | XmlAttribute |
void | _TestTinyXml () |
Interior node.
Definition at line 34 of file XmlElement.h.
XmlAttributePtr XmlElement::Attribute | ( | const String & | name | ) | const [inline] |
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition at line 72 of file XmlElement.h.
StringPtr XmlElement::InnerText | ( | ) | const [virtual] |
Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the XmlText child and accessing it directly.
If the first child of 'this' is a TiXmlText, the GetText() returns the character string of the Text node, else null is returned.
This is a convenient method for getting the text of simple contained text:
<foo>This is text</foo> const char* str = fooElement->GetText();
'str' will be a pointer to "This is text".
Note that this function can be misleading. If the element foo was created from this XML:
<foo><b>This is text</b></foo>
then the value of str would be null. The first child node isn't a text node, it is another element. From this XML:
<foo>This is <b>text</b></foo>
GetText() will return "This is ".
WARNING: GetText() accesses a child node - don't become confused with the similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are safe type casts on the referenced node.
Reimplemented from XmlNode.
Definition at line 236 of file TinyXmlElement.cpp.
References XmlNode::FirstChild().
void XmlElement::RemoveAttribute | ( | const String & | name | ) |
Deletes an attribute with the given name.
Definition at line 32 of file TinyXmlElement.cpp.
void XmlElement::SetAttribute | ( | const String & | name, | |
double | value | |||
) | [inline] |
Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.
Definition at line 106 of file XmlElement.h.
References SetAttribute().
void XmlElement::SetAttribute | ( | const String & | name, | |
int | val | |||
) | [inline] |
Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.
Definition at line 98 of file XmlElement.h.
References SetAttribute().
Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.
Definition at line 113 of file TinyXmlElement.cpp.
Referenced by SetAttribute().