|
FERS 1.0.0
The Flexible Extensible Radar Simulator
|
Class representing a node in an XML document. More...
#include "libxml_wrapper.h"
Public Member Functions | |
| XmlElement (const xmlNode *node) | |
| Constructor for XmlElement. | |
| XmlElement (const XmlElement &)=default | |
| XmlElement (XmlElement &&) noexcept=default | |
| XmlElement & | operator= (const XmlElement &)=default |
| XmlElement & | operator= (XmlElement &&) noexcept=default |
| ~XmlElement ()=default | |
| std::string_view | name () const noexcept |
| Get the name of the XML element. | |
| std::string | getText () const |
| Get the text content of the XML element. | |
| void | setText (const std::string_view text) const |
| Set the text content of the XML element. | |
| void | setAttribute (const std::string_view name, const std::string_view value) const |
| Set an attribute on the XML element. | |
| XmlElement | addChild (const std::string_view name) const noexcept |
| Add a child element to the current node. | |
| XmlElement | childElement (const std::string_view name="", const unsigned index=0) const noexcept |
| Retrieve a child element by name and index. | |
| bool | isValid () const noexcept |
| Check if the XML element is valid. | |
| xmlNodePtr | getNode () const noexcept |
| Get the underlying XML node pointer. | |
Static Public Member Functions | |
| static std::string | getSafeAttribute (const XmlElement &element, const std::string_view name) |
| Get the value of an attribute safely. | |
Class representing a node in an XML document.
This class encapsulates an XML element, allowing users to access and manipulate element names, attributes, content, and children. It uses libxml2 for all operations and provides simplified methods to interact with XML nodes.
Definition at line 53 of file libxml_wrapper.h.
|
explicit |
Constructor for XmlElement.
| node | The xmlNode pointer representing the XML element. |
Definition at line 63 of file libxml_wrapper.h.
|
default |
|
defaultnoexcept |
|
default |
|
noexcept |
Add a child element to the current node.
| name | The name of the new child element. |
Definition at line 150 of file libxml_wrapper.h.
References name().
Referenced by serial::world_to_xml_string().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Retrieve a child element by name and index.
| name | The name of the child element (optional). |
| index | The index of the child to retrieve. |
Definition at line 164 of file libxml_wrapper.h.
References name().
Referenced by radar::FileTarget::FileTarget(), parseElements(), and removeIncludeElements().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Get the underlying XML node pointer.
Definition at line 197 of file libxml_wrapper.h.
Referenced by getSafeAttribute(), mergeXmlDocuments(), and XmlDocument::setRootElement().
Here is the caller graph for this function:
|
static |
Get the value of an attribute safely.
| element | The XmlElement to retrieve the attribute from. |
| name | The name of the attribute. |
| XmlException | if the attribute is not found. |
Definition at line 117 of file libxml_wrapper.h.
References getNode(), and name().
Here is the call graph for this function:| std::string XmlElement::getText | ( | ) | const |
Get the text content of the XML element.
Definition at line 87 of file libxml_wrapper.h.
|
noexcept |
Check if the XML element is valid.
Definition at line 190 of file libxml_wrapper.h.
Referenced by parseElements().
Here is the caller graph for this function:
|
noexcept |
Get the name of the XML element.
Definition at line 80 of file libxml_wrapper.h.
Referenced by addChild(), childElement(), getSafeAttribute(), and setAttribute().
Here is the caller graph for this function:
|
default |
|
defaultnoexcept |
| void XmlElement::setAttribute | ( | const std::string_view | name, |
| const std::string_view | value | ||
| ) | const |
Set an attribute on the XML element.
| name | The name of the attribute. |
| value | The value to set for the attribute. |
Definition at line 138 of file libxml_wrapper.h.
References name().
Referenced by serial::world_to_xml_string().
Here is the call graph for this function:
Here is the caller graph for this function:| void XmlElement::setText | ( | const std::string_view | text | ) | const |
Set the text content of the XML element.
| text | The text to set as the content of the node. |
Definition at line 104 of file libxml_wrapper.h.