DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
User abstraction class to manipulate named XML elements (references) within a document. More...
#include <XMLElements.h>
Public Member Functions | |
RefElement (const Handle_t &e) | |
Construction from existing object handle. More... | |
RefElement (const RefElement &e) | |
Copy constructor. More... | |
RefElement (const Document &d, const XmlChar *type, const XmlChar *name) | |
Initializing constructor to create a new XMLElement and add it to the document. More... | |
RefElement & | operator= (const RefElement &e) |
Assignment operator. More... | |
const XmlChar * | name () const |
Access the object's name in unicode. More... | |
const XmlChar * | refName () const |
Access the object's reference name in unicode (same as name) More... | |
void | setName (const XmlChar *new_name) |
Change/set the object's name. More... | |
Public Member Functions inherited from dd4hep::xml::Element | |
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 | |
Attribute | m_name |
Attribute holding thre name. More... | |
Public Attributes inherited from dd4hep::xml::Element | |
Handle_t | m_element |
The underlying object holding the XmlElement pointer. More... | |
Additional Inherited Members | |
Public Types inherited from dd4hep::xml::Element | |
typedef Handle_t::Elt_t | Elt_t |
Simplification type declarations. More... | |
User abstraction class to manipulate named XML elements (references) within a document.
User class encapsulating a DOM element which can be referenced. Like the Element, but the "name" attribute is required. The reference then has the corresponding "ref" attribute. The value of "name" and "ref" must match to establish the reference.
Definition at line 953 of file XMLElements.h.
RefElement::RefElement | ( | const Handle_t & | e | ) |
Construction from existing object handle.
Definition at line 1161 of file XMLElements.cpp.
RefElement::RefElement | ( | const RefElement & | e | ) |
Copy constructor.
Definition at line 1167 of file XMLElements.cpp.
Initializing constructor to create a new XMLElement and add it to the document.
Definition at line 1155 of file XMLElements.cpp.
const XmlChar * RefElement::name | ( | ) | const |
Access the object's name in unicode.
Definition at line 1177 of file XMLElements.cpp.
RefElement & RefElement::operator= | ( | const RefElement & | e | ) |
Assignment operator.
Definition at line 1172 of file XMLElements.cpp.
const XmlChar * RefElement::refName | ( | ) | const |
Access the object's reference name in unicode (same as name)
Definition at line 1183 of file XMLElements.cpp.
void RefElement::setName | ( | const XmlChar * | new_name | ) |
Change/set the object's name.
Definition at line 1189 of file XMLElements.cpp.
Attribute dd4hep::xml::RefElement::m_name |
Attribute holding thre name.
Definition at line 956 of file XMLElements.h.