MUSX Document Model
|
Interface for an XML element. More...
#include <XmlInterface.h>
Public Member Functions | |
virtual std::string | getTagName () const =0 |
Gets the tag name of the element. | |
virtual std::string | getText () const =0 |
Gets the text content of the element. | |
std::string | getTextTrimmed () const |
Gets the text content of the element with whitespace trimmed. | |
template<typename T > | |
T | getTextAs (T defaultValue={}) const |
Gets the text content of the element, converted to the specified type. | |
virtual std::shared_ptr< IXmlAttribute > | getFirstAttribute () const =0 |
Gets the first attribute. | |
virtual std::shared_ptr< IXmlAttribute > | findAttribute (const std::string &name) const =0 |
Finds the first attribute. | |
virtual XmlElementPtr | getFirstChildElement (const std::string &tagName={}) const =0 |
Finds the first child element. | |
virtual XmlElementPtr | getNextSibling (const std::string &tagName={}) const =0 |
Gets the next sibling element. | |
virtual XmlElementPtr | getPreviousSibling (const std::string &tagName={}) const =0 |
Gets the previous sibling element. | |
virtual XmlElementPtr | getParent () const =0 |
Gets the parent element. | |
Interface for an XML element.
|
pure virtual |
Finds the first attribute.
name | The name of the attribute to find. |
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Gets the first attribute.
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Finds the first child element.
tagName | [optional] The tag name of the child elements to find. If omitted or empty, finds the first child with any name. |
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Gets the next sibling element.
tagName | [optional] The tag name of the sibling elements to find. If omitted or empty, finds the next sibling with any name. |
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Gets the parent element.
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Gets the previous sibling element.
tagName | [optional] The tag name of the sibling elements to find. If omitted or empty, finds the previous sibling with any name. |
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Gets the tag name of the element.
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
pure virtual |
Gets the text content of the element.
Implemented in musx::xml::pugi::Element, musx::xml::rapidxml::Element, and musx::xml::tinyxml2::Element.
|
inline |
Gets the text content of the element, converted to the specified type.
T | The type to which the text content should be converted. |
defaultValue | The value to return if the text of the element is empty. |
std::invalid_argument | if the conversion fails. |