Orcus
Loading...
Searching...
No Matches
orcus::xml_structure_tree::walker Class Reference

#include <xml_structure_tree.hpp>

Public Member Functions

 walker (const walker &r)
 
walkeroperator= (const walker &r)
 
element root ()
 
element descend (const entity_name &name)
 
element ascend ()
 
element move_to (const std::string &path)
 
entity_names_type get_children ()
 
entity_names_type get_attributes ()
 
size_t get_xmlns_index (xmlns_id_t ns) const
 
std::string get_xmlns_short_name (xmlns_id_t ns) const
 
std::string to_string (const entity_name &name) const
 
std::string get_path () const
 

Friends

class xml_structure_tree
 

Detailed Description

This class allows client to traverse the tree.

Member Function Documentation

◆ ascend()

element orcus::xml_structure_tree::walker::ascend ( )

Move up to the parent element.

◆ descend()

element orcus::xml_structure_tree::walker::descend ( const entity_name & name)

Descend into a specified child element.

Parameters
namename of a child element.
Returns
child element
Exceptions
general_errorif no child elements exist for the specified name.

◆ get_attributes()

entity_names_type orcus::xml_structure_tree::walker::get_attributes ( )

Get a list of names of all attributes that belong to current element. The list of names is in order of appearance.

Returns
list of attribute names in order of appearance.

◆ get_children()

entity_names_type orcus::xml_structure_tree::walker::get_children ( )

Get a list of names of all child elements at the current element position. The list of names is in order of appearance.

Returns
list of child element names in order of appearance.

◆ get_path()

std::string orcus::xml_structure_tree::walker::get_path ( ) const

Get a XPath like ID for the element inside of the XML tree.

◆ get_xmlns_index()

size_t orcus::xml_structure_tree::walker::get_xmlns_index ( xmlns_id_t ns) const

Get a numerical, 0-based index of given XML namespace.

Parameters
nsXML namespace ID.
Returns
numeric, 0-based index of XML namespace if found, or xml_structure_tree::walker::index_not_found if the namespace is not found in this structure.

◆ move_to()

element orcus::xml_structure_tree::walker::move_to ( const std::string & path)

Move to the element specified by a path expression. The path expression may be generated by xml_structure_tree::walker::get_path.

Parameters
patha simple XPath like expression
Returns
element pointed to by the path.

◆ root()

element orcus::xml_structure_tree::walker::root ( )

Set current position to the root element, and return the root element.

Returns
root element.

◆ to_string()

std::string orcus::xml_structure_tree::walker::to_string ( const entity_name & name) const

Convert an entity name to its proper string representation.

Parameters
nameentity name to convert to string.
Returns
string representation of the entity name, including the namespace.