DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
User abstraction class to manipulate XML elements within a document. More...
#include <XMLElements.h>
Public Types | |
typedef Handle_t::Elt_t | Elt_t |
Simplification type declarations. More... | |
Public Member Functions | |
Element (const Handle_t &e) | |
Constructor from XmlElement handle. More... | |
Element (const Element &e) | |
Constructor from XmlElement handle. More... | |
Element (const Document &document, const XmlChar *type) | |
Constructor from DOM document entity. More... | |
Document | document () const |
Access the hosting document handle of this DOM element. More... | |
operator bool () const | |
operator bool: check handle validity More... | |
bool | operator! () const |
operator NOT: check handle validity More... | |
Element & | operator= (const Element &c) |
Assignment operator. More... | |
Element & | operator= (Handle_t handle) |
Assignment operator. More... | |
operator Handle_t () const | |
Automatic conversion to DOM element handle. More... | |
operator Elt_t () const | |
Automatic conversion to XmlElement pointer. More... | |
Elt_t | ptr () const |
Access to XmlElement pointer. More... | |
Handle_t | parent () const |
Access the XmlElements parent. More... | |
Elt_t | parentElement () const |
Access the XmlElements parent. More... | |
std::string | tag () const |
Access the tag name of this DOM element. More... | |
const XmlChar * | tagName () const |
Access the tag name of this DOM element. More... | |
std::string | text () const |
Access the tag name of this DOM element. More... | |
void | text (const std::string value) const |
Set text attribute to the XML node. More... | |
void | append (Handle_t handle) const |
Append a new element to the existing tree. More... | |
Handle_t | clone (const Document &new_doc) const |
Clone the DOMelement. More... | |
bool | hasAttr (const XmlChar *name) const |
Check for the existence of a named attribute. More... | |
template<class T > | |
T | attr (const XmlAttr *att) const |
Access attribute with implicit return type conversion. More... | |
template<class T > | |
T | attr (const XmlChar *tag_value) const |
Access attribute with implicit return type conversion. More... | |
template<class T > | |
T | attr (const XmlChar *tag_value, T default_value) const |
Access attribute with implicit return type conversion. More... | |
template<class T > | |
T | attr (const char *name) const |
Access typed attribute value by its name. More... | |
template<class T > | |
T | attr (const char *name, T default_value) const |
Access typed attribute value by its name. More... | |
const XmlChar * | attr_name (const Attribute a) const |
Access attribute name (throws exception if not present) More... | |
const XmlChar * | attr_value (const Attribute a) const |
Access attribute value by the attribute (throws exception if not present) More... | |
size_t | numChildren (const XmlChar *tag_value, bool exc=true) const |
Access the number of children of this DOM element with a given tag name. More... | |
void | setAttrs (Handle_t e) const |
Remove own attributes and copy all attributes from handle 'e'. More... | |
void | removeAttrs () const |
Remove all attributes of this element. More... | |
std::vector< Attribute > | attributes () const |
Retrieve a collection of all attributes of this DOM element. More... | |
Attribute | getAttr (const XmlChar *name) const |
Access single attribute by its name. More... | |
template<class T > | |
Attribute | setAttr (const XmlChar *nam, const T &val) const |
Set single attribute. More... | |
template<class T > | |
void | setValue (const T &val) const |
Set element value. More... | |
Handle_t | clone (Handle_t h) const |
Clone the DOM element tree. More... | |
Handle_t | addChild (const XmlChar *tag) const |
Add a new child to the DOM node. More... | |
Handle_t | setChild (const XmlChar *tag) const |
Check if a child with the required tag exists - if not create it and add it to the current node. More... | |
Handle_t | child (const Strng_t &tag_value, bool except=true) const |
Access child by tag name. Thow an exception if required in case the child is not present. More... | |
Handle_t | remove (Handle_t node) const |
Remove a child node identified by its handle. More... | |
bool | hasChild (const XmlChar *tag_value) const |
Check the existence of a child with a given tag name. More... | |
Attribute | setRef (const XmlChar *tag, const XmlChar *refname) const |
Set the reference attribute to the node (adds attribute ref="ref-name") More... | |
Attribute | setRef (const XmlChar *tag, const std::string &refname) const |
Set the reference attribute to the node (adds attribute ref="ref-name") More... | |
const XmlChar * | getRef (const XmlChar *tag) const |
Access the value of the reference attribute of the node (attribute ref="ref-name") More... | |
void | addComment (const XmlChar *text) const |
Add comment node to the element. More... | |
void | addComment (const char *text) const |
Add comment node to the element. More... | |
void | addComment (const std::string &text_value) const |
Add comment node to the element. More... | |
Public Attributes | |
Handle_t | m_element |
The underlying object holding the XmlElement pointer. More... | |
User abstraction class to manipulate XML elements within a document.
User class encapsulating a DOM element using the Handle_t helper. This is the main class we interact with when analysing the xml documents for constructing sub-detectors etc.
Definition at line 769 of file XMLElements.h.
Simplification type declarations.
Definition at line 772 of file XMLElements.h.
|
inline |
Constructor from XmlElement handle.
Definition at line 778 of file XMLElements.h.
|
inline |
Constructor from XmlElement handle.
Definition at line 780 of file XMLElements.h.
Constructor from DOM document entity.
Definition at line 1075 of file XMLElements.cpp.
Add a new child to the DOM node.
Definition at line 1121 of file XMLElements.cpp.
void Element::addComment | ( | const char * | text | ) | const |
Add comment node to the element.
Definition at line 1141 of file XMLElements.cpp.
void Element::addComment | ( | const std::string & | text_value | ) | const |
Add comment node to the element.
Definition at line 1150 of file XMLElements.cpp.
void Element::addComment | ( | const XmlChar * | text | ) | const |
Add comment node to the element.
Definition at line 1135 of file XMLElements.cpp.
|
inline |
Append a new element to the existing tree.
Definition at line 839 of file XMLElements.h.
|
inline |
Access typed attribute value by its name.
Definition at line 864 of file XMLElements.h.
|
inline |
Access typed attribute value by its name.
Definition at line 868 of file XMLElements.h.
|
inline |
Access attribute with implicit return type conversion.
Definition at line 851 of file XMLElements.h.
|
inline |
Access attribute with implicit return type conversion.
Definition at line 855 of file XMLElements.h.
|
inline |
Access attribute with implicit return type conversion.
Definition at line 859 of file XMLElements.h.
Access attribute name (throws exception if not present)
Definition at line 873 of file XMLElements.h.
Access attribute value by the attribute (throws exception if not present)
Definition at line 877 of file XMLElements.h.
|
inline |
Retrieve a collection of all attributes of this DOM element.
Definition at line 893 of file XMLElements.h.
Access child by tag name. Thow an exception if required in case the child is not present.
Definition at line 914 of file XMLElements.h.
Clone the DOMelement.
Definition at line 843 of file XMLElements.h.
Clone the DOM element tree.
Definition at line 1094 of file XMLElements.cpp.
Document Element::document | ( | ) | const |
Access the hosting document handle of this DOM element.
Definition at line 1089 of file XMLElements.cpp.
Access single attribute by its name.
Definition at line 1101 of file XMLElements.cpp.
Access the value of the reference attribute of the node (attribute ref="ref-name")
Definition at line 1116 of file XMLElements.cpp.
|
inline |
Check for the existence of a named attribute.
Definition at line 847 of file XMLElements.h.
|
inline |
Check the existence of a child with a given tag name.
Definition at line 922 of file XMLElements.h.
|
inline |
Access the number of children of this DOM element with a given tag name.
Definition at line 881 of file XMLElements.h.
|
inline |
operator bool: check handle validity
Definition at line 787 of file XMLElements.h.
|
inline |
Automatic conversion to XmlElement pointer.
Definition at line 809 of file XMLElements.h.
|
inline |
Automatic conversion to DOM element handle.
Definition at line 805 of file XMLElements.h.
|
inline |
operator NOT: check handle validity
Definition at line 791 of file XMLElements.h.
Assignment operator.
Definition at line 795 of file XMLElements.h.
Assignment operator.
Definition at line 800 of file XMLElements.h.
|
inline |
Access the XmlElements parent.
Definition at line 817 of file XMLElements.h.
Element::Elt_t Element::parentElement | ( | ) | const |
Access the XmlElements parent.
Definition at line 1080 of file XMLElements.cpp.
|
inline |
Access to XmlElement pointer.
Definition at line 813 of file XMLElements.h.
Remove a child node identified by its handle.
Definition at line 918 of file XMLElements.h.
|
inline |
Remove all attributes of this element.
Definition at line 889 of file XMLElements.h.
|
inline |
Set single attribute.
Definition at line 900 of file XMLElements.h.
|
inline |
Remove own attributes and copy all attributes from handle 'e'.
Definition at line 885 of file XMLElements.h.
Check if a child with the required tag exists - if not create it and add it to the current node.
Definition at line 1128 of file XMLElements.cpp.
Set the reference attribute to the node (adds attribute ref="ref-name")
Definition at line 1111 of file XMLElements.cpp.
Set the reference attribute to the node (adds attribute ref="ref-name")
Definition at line 1106 of file XMLElements.cpp.
|
inline |
Set element value.
Definition at line 904 of file XMLElements.h.
|
inline |
Access the tag name of this DOM element.
Definition at line 823 of file XMLElements.h.
|
inline |
Access the tag name of this DOM element.
Definition at line 827 of file XMLElements.h.
|
inline |
Access the tag name of this DOM element.
Definition at line 831 of file XMLElements.h.
|
inline |
Set text attribute to the XML node.
Definition at line 835 of file XMLElements.h.
Handle_t dd4hep::xml::Element::m_element |
The underlying object holding the XmlElement pointer.
Definition at line 775 of file XMLElements.h.