ADTF  3.18.2
DOM

XML parser to read and write standard XML files. More...

Public Member Functions

 DOM ()
 CTOR.
 
 ~DOM ()
 DTOR.
 
 DOM (const DOM &dom)
 Copy constructor. More...
 
DOMoperator= (const DOM &dom)
 Copy assignment. More...
 
bool load (const std::string &file_path)
 Loads an xml file. More...
 
bool save (const std::string &file_path) const
 save document to an xml file More...
 
bool fromString (const std::string &xml)
 Create the dom from an input string. More...
 
std::string toString () const
 Creates an xml string representation of the dom. More...
 
void reset ()
 Resets the instance to the empty state. More...
 
DOMElement getRoot () const
 Get root element of the dom. More...
 
bool findNode (const std::string &query, DOMElement &element_ptr) const
 Finds a node based on a query See DOMElement::findNode() for the syntax. More...
 
bool findNodes (const std::string &query, DOMElementList &elements) const
 Finds nodes based on a query. More...
 
std::string getLastError () const
 Get the last error description occurred. More...
 
bool isNull () const
 Check whether this DOM is empty. More...
 

Private Attributes

memory::StackPtr< Implementation, 280 > _impl
 

Detailed Description

Constructor & Destructor Documentation

◆ DOM()

DOM ( const DOM dom)

Copy constructor.

Parameters
[in]domThe object to copy from

Member Function Documentation

◆ findNode()

bool findNode ( const std::string &  query,
DOMElement element_ptr 
) const

Finds a node based on a query See DOMElement::findNode() for the syntax.

Parameters
[in]queryThe query string
[out]element_ptrThis will point to the found element.
Returns
Whether or not the node was found

◆ findNodes()

bool findNodes ( const std::string &  query,
DOMElementList elements 
) const

Finds nodes based on a query.

See DOMElement::findNode() for the syntax.

Parameters
[in]queryThe query string
[out]elementsThis list will be filled with the found elements
Returns
Whether or not any nodes where found

◆ fromString()

bool fromString ( const std::string &  xml)

Create the dom from an input string.

Parameters
[in]xmlString which must have a valid XML syntax
Returns
false string is invalid (check DOM::getLastError()), otherwise true

◆ getLastError()

std::string getLastError ( ) const

Get the last error description occurred.

Returns
The last occurred error

◆ getRoot()

DOMElement getRoot ( ) const

Get root element of the dom.

Returns
The root element of the dom

◆ isNull()

bool isNull ( ) const

Check whether this DOM is empty.

Returns
true if empty, false otherwise

◆ load()

bool load ( const std::string &  file_path)

Loads an xml file.

Parameters
[in]file_pathPath to the filename
Returns
false if file could not be loaded (check DOM::getLastError()), otherwise true

◆ operator=()

DOM& operator= ( const DOM dom)

Copy assignment.

Parameters
[in]domThe element to copy from
Returns
Reference to *this

◆ reset()

void reset ( )

Resets the instance to the empty state.

Postcondition
this->IsNull()

◆ save()

bool save ( const std::string &  file_path) const

save document to an xml file

Parameters
[in]file_pathPath to the file to save
Returns
false if file could not be safed (check DOM::getLastError()), otherwise true

◆ toString()

std::string toString ( ) const

Creates an xml string representation of the dom.

Returns
XML string representation of the dom