16 #ifndef A_UTILS_UTIL_XML_DOM_HEADER_INCLUDED_
17 #define A_UTILS_UTIL_XML_DOM_HEADER_INCLUDED_
75 const std::string& def_value = std::string())
const;
134 bool setAttribute(
const std::string& name,
const std::string& strValue);
246 const std::string& attribute,
262 const std::string& attribute,
264 std::size_t number_of_nodes);
304 class Implementation;
344 bool load(
const std::string& file_path);
351 bool save(
const std::string& file_path)
const;
411 class Implementation;
Representation for an element in the DOM.
bool removeChild(const std::string &name)
Erases the first child of that name in this element.
bool findNodes(const std::string &query, DOMElementList &elements) const
Finds nodes based on a query.
DOMElement & operator=(const DOMElement &element)
Copy assignment operator.
DOMElement(const DOMElement &element)
Copy constructor.
DOMElement getParent() const
Get this elements parent element.
DOMElement createChild(const std::string &name)
Creates a new child element.
bool sortNodes(const std::string &query, SortingOrder order, std::size_t number_of_nodes)
Sort all queried nodes by name example:
bool setAttribute(const std::string &name, const std::string &strValue)
Sets an attribute.
std::string getData() const
Get the data of the element.
DOMElement createChildBefore(const std::string &name, const DOMElement &before)
Creates a new child element before an existing child element.
std::string getAttribute(const std::string &name, const std::string &def_value=std::string()) const
Returns the value of an attribute with name.
DOMElementList getChildren() const
Get a list of all child elements of the element.
std::size_t sortNodes(const std::string &query, const std::string &attribute, SortingOrder order)
Sort the queried nodes by attribute example:
std::string getPath() const
Get current path of the element.
bool findNode(const std::string &query, DOMElement &element_ptr) const
Finds a node based on a query.
bool setName(const std::string &name)
Sets the name of the element.
bool setData(const std::string &data)
Sets the data of the element.
std::string getName() const
Get the name of the element.
bool sortNodes(const std::string &query, SortingOrder order)
Sort the queried nodes by name example:
DOMElement getChild(const std::string &name) const
Get the first child mathing the name of this element.
friend bool operator==(const DOMElement &lhs, const DOMElement &rhs)
Comparison operator.
bool sortNodes(const std::string &query, const std::string &attribute, SortingOrder order, std::size_t number_of_nodes)
Sort all queried nodes by attribute example:
bool isNull() const
Check whether this DOMElement is empty.
DOMAttributes getAttributes() const
Get a map of all attributes of this element.
bool hasAttribute(const std::string &name) const
Checks if an attribute exists.
DOM getDocument() const
Get the DOM document this element belongs to.
bool eraseAttribute(const std::string &name)
Removes an attribute.
Exception class used by the DOM classes.
DOMException(const std::string &what)
CTOR.
XML parser to read and write standard XML files.
DOMElement getRoot() const
Get root element of the dom.
DOM(const DOM &dom)
Copy constructor.
bool findNodes(const std::string &query, DOMElementList &elements) const
Finds nodes based on a query.
std::string toString() const
Creates an xml string representation of the dom.
std::string getLastError() const
Get the last error description occurred.
DOM & operator=(const DOM &dom)
Copy assignment.
bool findNode(const std::string &query, DOMElement &element_ptr) const
Finds a node based on a query See DOMElement::findNode() for the syntax.
bool fromString(const std::string &xml)
Create the dom from an input string.
bool load(const std::string &file_path)
Loads an xml file.
bool isNull() const
Check whether this DOM is empty.
void reset()
Resets the instance to the empty state.
bool save(const std::string &file_path) const
save document to an xml file
Several enums for project wide use.
bool operator==(const DOM &lhs, const DOM &rhs)
Comparison operator.
bool operator!=(const DOMElement &lhs, const DOMElement &rhs)
Incomparison operator.
std::map< std::string, std::string > DOMAttributes
Type alias for DOM attributes.
std::list< DOMElement > DOMElementList
Tyoe alias for DOMElement lists.
Serves as the root component, with common functionality documented in core functionality.
SortingOrder
Flags for functions that need to sort elements.
Common include for StackPtr functionality.