My Project
CXMLElement Class Reference

This class implements a facade for the xml Element. More...

#include <mia/core/xmlinterface.hh>

Public Types

typedef std::shared_ptr< CXMLElementPointer

Public Member Functions

CXMLElement::Pointer add_child (const char *name)
 add a new child element
 CXMLElement (const char *name)
 CXMLElement (const CXMLElement &orig)=delete
const std::vector< CXMLElement::Pointer > & get_all_children () const
const std::string get_attribute (const std::string &name) const
std::vector< CXMLElement::Pointerget_children (const char *name) const
const std::string & get_content () const
const std::string & get_name () const
CXMLElementoperator= (const CXMLElement &orig)=delete
void set_attribute (const char *name, const std::string &value)
 Set an attribute of the node.
void set_child_text (const std::string &value)
 ~CXMLElement ()

Friends

class CXMLDocument

Detailed Description

This class implements a facade for the xml Element.

This class implements a facade for the XML IO to makes it possible to change the used underlying XML implementation. It is also useful to reduce the compile time dependencies for programs that use MIA.

The implemented support for XML is limted, i.e. there is no support for namespaces, schemes, and interleaved node content.

Definition at line 49 of file xmlinterface.hh.

Member Typedef Documentation

◆ Pointer

typedef std::shared_ptr<CXMLElement> CXMLElement::Pointer

Definition at line 52 of file xmlinterface.hh.

Constructor & Destructor Documentation

◆ CXMLElement() [1/2]

CXMLElement::CXMLElement ( const char * name)

Create a new node

Parameters
nametag of the node

Referenced by CXMLElement(), and operator=().

◆ ~CXMLElement()

CXMLElement::~CXMLElement ( )

◆ CXMLElement() [2/2]

CXMLElement::CXMLElement ( const CXMLElement & orig)
delete

References CXMLElement().

Member Function Documentation

◆ add_child()

CXMLElement::Pointer CXMLElement::add_child ( const char * name)

add a new child element

This method adds a new child element to this node

Parameters
namename tag of the new child element
Returns
the newly created node

◆ get_all_children()

const std::vector< CXMLElement::Pointer > & CXMLElement::get_all_children ( ) const
Returns
all child nodes

◆ get_attribute()

const std::string CXMLElement::get_attribute ( const std::string & name) const

retrive an attribute value

Parameters
nameattribute name to retrive
Returns
attribute value as string, if the attribute doesn't extist an empty string is returned

◆ get_children()

std::vector< CXMLElement::Pointer > CXMLElement::get_children ( const char * name) const

retrive first level children with a certain tag

Parameters
nametag of the nodes to be retrived
Returns
a vector containing the nodes with the requested tag

◆ get_content()

const std::string & CXMLElement::get_content ( ) const
Returns
the content of the node as string

◆ get_name()

const std::string & CXMLElement::get_name ( ) const
Returns
Get name tag of the node

◆ operator=()

CXMLElement & CXMLElement::operator= ( const CXMLElement & orig)
delete

References CXMLElement().

◆ set_attribute()

void CXMLElement::set_attribute ( const char * name,
const std::string & value )

Set an attribute of the node.

This method sets an attribute of a node

Parameters
nameattribute name
value(string) value of the attribute

◆ set_child_text()

void CXMLElement::set_child_text ( const std::string & value)

Set the child text of the node

Parameters
valuetext value to be set

◆ CXMLDocument

friend class CXMLDocument
friend

Definition at line 124 of file xmlinterface.hh.

References CXMLDocument.

Referenced by CXMLDocument.


The documentation for this class was generated from the following file: