An XML element. More...
#include <dom.h>
Public Member Functions | |
template<class String > | |
String | getNameAs () const |
Retrieve the name of this XML element. More... | |
template<class T > | |
bool | getValue (T &value) const |
Get the value of this element as a user type. More... | |
template<class T > | |
void | setValue (const T &value) |
Set the value of this element. More... | |
template<class String , class T > | |
bool | getAttribute (const String &name, T &value) const |
Retrieve an attribute by name. More... | |
template<class String , class T > | |
void | setAttribute (const String &name, const T &value) |
Create or update an XML attribute. More... | |
template<class String > | |
void | removeAttribute (const String &name) |
Remove the attribute with the given name. More... | |
template<class String > | |
XmlElement & | addChild (const String &name) |
Create a new child element and return a reference to it. More... | |
template<class String > | |
const XmlElement * | getChild (const String &name) const |
Retrieve a child element with the given name. More... | |
template<class String > | |
XmlElement * | getChild (const String &name) |
template<class String > | |
std::pair< ChildIterConst2, ChildIterConst2 > | getChildren (const String &name) const |
Access all child elements with the given name via STL iterators. More... | |
template<class String > | |
std::pair< ChildIter2, ChildIter2 > | getChildren (const String &name) |
std::pair< ChildIterConst, ChildIterConst > | getChildren () const |
Access all child elements sequentially via STL iterators. More... | |
std::pair< ChildIter, ChildIter > | getChildren () |
XmlElement * | parent () |
Get parent XML element, may be nullptr for root element. | |
const XmlElement * | parent () const |
Get parent XML element, may be nullptr for root element. | |
An XML element.
XmlElement& zen::XmlElement::addChild | ( | const String & | name | ) |
Create a new child element and return a reference to it.
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
name | The name of the child element to be created. |
bool zen::XmlElement::getAttribute | ( | const String & | name, |
T & | value | ||
) | const |
Retrieve an attribute by name.
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
T | String-convertible user data type: e.g. any string class, all built-in arithmetic numbers |
name | The name of the attribute to retrieve. |
value | The value of the attribute converted to T. |
const XmlElement* zen::XmlElement::getChild | ( | const String & | name | ) | const |
Retrieve a child element with the given name.
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
name | The name of the child element to be retrieved. |
XmlElement* zen::XmlElement::getChild | ( | const String & | name | ) |
std::pair<ChildIterConst2, ChildIterConst2> zen::XmlElement::getChildren | ( | const String & | name | ) | const |
Access all child elements with the given name via STL iterators.
name | The name of the child elements to be retrieved. |
std::pair<ChildIter2, ChildIter2> zen::XmlElement::getChildren | ( | const String & | name | ) |
std::pair<ChildIterConst, ChildIterConst> zen::XmlElement::getChildren | ( | ) | const |
Access all child elements sequentially via STL iterators.
std::pair<ChildIter, ChildIter> zen::XmlElement::getChildren | ( | ) |
String zen::XmlElement::getNameAs | ( | ) | const |
Retrieve the name of this XML element.
String | Arbitrary string class: e.g. std::string, std::wstring, wxString, MyStringClass, ... |
bool zen::XmlElement::getValue | ( | T & | value | ) | const |
Get the value of this element as a user type.
T | Arbitrary user data type: e.g. any string class, all built-in arithmetic numbers, STL container, ... |
void zen::XmlElement::removeAttribute | ( | const String & | name | ) |
Remove the attribute with the given name.
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
void zen::XmlElement::setAttribute | ( | const String & | name, |
const T & | value | ||
) |
Create or update an XML attribute.
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
T | String-convertible user data type: e.g. any string-like type, all built-in arithmetic numbers |
name | The name of the attribute to create or update. |
value | The value to set. |
void zen::XmlElement::setValue | ( | const T & | value | ) |
Set the value of this element.
T | Arbitrary user data type: e.g. any string-like type, all built-in arithmetic numbers, STL container, ... |