Reader for XML Messages. More...
Public Member Functions | |
this (in char[] xml_str, in char[] system_id="") | |
XMLDoc | get_document () |
XMLNode | cur () |
access to current node | |
XMLNode | opCast () |
automatic access to current node | |
XMLNode | opCall () |
call operator access to current node (instead of the C++ operator-> and operator*) | |
char[] | get (in char[] attr_name, in char[] def="") |
attribute access | |
void | put (in char[] attr_name, in char[] value) |
attribute setting | |
char[] | opIndex (in char[] attr_name) |
void | opIndexAssign (in char[] attr_name, in char[] value) |
void | add_down (XMLNode child) |
insert children when building tree | |
bool | back () |
go back to previous position | |
bool | go_down () |
go down to first child | |
bool | go_down (in char[] name, int n=0) |
search for child and go down | |
bool | go (in char[] path) |
move XPath like to position in XML tree | |
bool | create_relative (in char[] path) |
create child nodes using XPath notation and move to the deepest child | |
void | create (in char[] name) |
create node and move to it | |
void | smart_create (in char[] name) |
create node if not already existing and move to it | |
void | smart_create (in char[] name, char[] attr_name, char[] attr_value) |
search matching child node identified by key name and an attribute value | |
char[] | str () |
Protected Member Functions | |
stack (XMLNode) _stack | |
void | go_to (XMLNode child) |
go to specified node | |
Protected Attributes | |
XMLDoc | _msg |
XMLNode | _root |
XMLNode | _cur |
Reader for XML Messages.
Definition at line 2262 of file xmlstorage.d.
xmlstorage::XMLMessageReader::this | ( | in char[] | xml_str, |
in char[] | system_id = "" |
||
) | [inline] |
Definition at line 2265 of file xmlstorage.d.
void xmlstorage::XMLPos::add_down | ( | XMLNode | child ) | [inline, inherited] |
insert children when building tree
Definition at line 1116 of file xmlstorage.d.
bool xmlstorage::XMLPos::back | ( | ) | [inline, inherited] |
go back to previous position
Definition at line 1123 of file xmlstorage.d.
{ if (!_stack.empty()) { _cur = _stack.pop(); return true; } else return false; }
void xmlstorage::XMLPos::create | ( | in char[] | name ) | [inline, inherited] |
create node and move to it
Definition at line 1188 of file xmlstorage.d.
{ add_down(new XMLNode(name)); }
bool xmlstorage::XMLPos::create_relative | ( | in char[] | path ) | [inline, inherited] |
create child nodes using XPath notation and move to the deepest child
Definition at line 1177 of file xmlstorage.d.
References xmlstorage::XMLNode::create_relative().
{ XMLNode node = _cur.create_relative(path); if (!node) return false; // invalid path specified go_to(node); return true; }
XMLNode xmlstorage::XMLPos::cur | ( | ) | [inline, inherited] |
char [] xmlstorage::XMLPos::get | ( | in char[] | attr_name, |
in char[] | def = "" |
||
) | [inline, inherited] |
attribute access
Definition at line 1094 of file xmlstorage.d.
References xmlstorage::XMLNode::get().
{ return _cur.get(attr_name, def); }
XMLDoc xmlstorage::XMLMessageReader::get_document | ( | ) | [inline] |
Definition at line 2272 of file xmlstorage.d.
{ return _msg; }
bool xmlstorage::XMLPos::go | ( | in char[] | path ) | [inline, inherited] |
move XPath like to position in XML tree
Definition at line 1157 of file xmlstorage.d.
References xmlstorage::XMLNode::find_relative().
{ XMLNode node = _cur; // Is this an absolute path? if (path.length>0 && path[0]=='/') { node = _root; path = path[1..length]; } node = node.find_relative(path); if (node) { go_to(node); return true; } else return false; }
bool xmlstorage::XMLPos::go_down | ( | ) | [inline, inherited] |
go down to first child
Definition at line 1133 of file xmlstorage.d.
References xmlstorage::XMLNode::get_first_child().
{ XMLNode node = _cur.get_first_child(); if (node) { go_to(node); return true; } else return false; }
bool xmlstorage::XMLPos::go_down | ( | in char[] | name, |
int | n = 0 |
||
) | [inline, inherited] |
search for child and go down
Definition at line 1145 of file xmlstorage.d.
References xmlstorage::XMLNode::find().
void xmlstorage::XMLPos::go_to | ( | XMLNode | child ) | [inline, protected, inherited] |
go to specified node
Definition at line 1226 of file xmlstorage.d.
XMLNode xmlstorage::XMLPos::opCall | ( | ) | [inline, inherited] |
call operator access to current node (instead of the C++ operator-> and operator*)
Definition at line 1088 of file xmlstorage.d.
{ return _cur; }
XMLNode xmlstorage::XMLPos::opCast | ( | ) | [inline, inherited] |
char [] xmlstorage::XMLPos::opIndex | ( | in char[] | attr_name ) | [inline, inherited] |
Definition at line 1105 of file xmlstorage.d.
{ return _cur[attr_name]; }
void xmlstorage::XMLPos::opIndexAssign | ( | in char[] | attr_name, |
in char[] | value | ||
) | [inline, inherited] |
Definition at line 1110 of file xmlstorage.d.
{ _cur[attr_name] = value; }
void xmlstorage::XMLPos::put | ( | in char[] | attr_name, |
in char[] | value | ||
) | [inline, inherited] |
void xmlstorage::XMLPos::smart_create | ( | in char[] | name ) | [inline, inherited] |
create node if not already existing and move to it
Definition at line 1194 of file xmlstorage.d.
References xmlstorage::XMLNode::find().
void xmlstorage::XMLPos::smart_create | ( | in char[] | name, |
char[] | attr_name, | ||
char[] | attr_value | ||
) | [inline, inherited] |
search matching child node identified by key name and an attribute value
Definition at line 1205 of file xmlstorage.d.
References xmlstorage::XMLNode::find(), and xmlstorage::XMLNode::put().
{ XMLNode node = _cur.find(name, attr_name, attr_value); if (node) go_to(node); else { node = new XMLNode(name); add_down(node); node.put(attr_name, attr_value); } }
xmlstorage::XMLPos::stack | ( | XMLNode | ) | [protected, inherited] |
char [] xmlstorage::XMLPos::str | ( | ) | [inline, inherited] |
Definition at line 1218 of file xmlstorage.d.
{return _cur._name;}
XMLNode xmlstorage::XMLPos::_cur [protected, inherited] |
Definition at line 1222 of file xmlstorage.d.
XMLDoc xmlstorage::XMLMessageReader::_msg [protected] |
Definition at line 2278 of file xmlstorage.d.
XMLNode xmlstorage::XMLPos::_root [protected, inherited] |
Definition at line 1221 of file xmlstorage.d.