Reader for XML Messages. More...
#include <xmlstorage.h>


Public Member Functions | |
| XMLMessageReader (const std::string &xml_str, const std::string &system_id=std::string()) | |
| const XMLDoc & | get_document () |
| XMLNode & | cur () |
| access to current node | |
| const XMLNode & | cur () const |
| operator const XMLNode * () const | |
| automatic access to current node | |
| operator XMLNode * () | |
| const XMLNode * | operator-> () const |
| XMLNode * | operator-> () |
| const XMLNode & | operator* () const |
| XMLNode & | operator* () |
| XS_String | get (const XS_String &attr_name, LPCXSSTR def=XS_EMPTY_STR) const |
| attribute access | |
| template<typename T > | |
| XS_String | get (const T &attr_name) const |
| index operator attribute access | |
| void | put (const XS_String &attr_name, const XS_String &value) |
| attribute setting | |
| XS_String & | operator[] (const XS_String &attr_name) |
| const XS_String & | operator[] (const XS_String &attr_name) const |
| 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 (const XS_String &child_name, int n=0) |
| search for child and go down | |
| bool | iterate (const XS_String &child_name, int &cnt) |
| iterate to the next matching child | |
| bool | go (const XPath &xpath) |
| move to the position defined by xpath in XML tree | |
| bool | create_relative (const XPath &xpath) |
| create child nodes using XPath notation and move to the deepest child | |
| void | create (const XS_String &name) |
| create node and move to it | |
| void | create_node_content (const XS_String &node_name, const XS_String &content) |
| create node with string content | |
| void | smart_create (const XS_String &child_name) |
| create node if not already existing and move to it | |
| void | smart_create (const XS_String &child_name, const XS_String &attr_name, const XS_String &attr_value) |
| search matching child node identified by key name and an attribute value | |
| int | count (const XPath &xpath) const |
| count the nodes matching the given relative XPath expression | |
| int | filter (const XPath &xpath, XMLNode &target) const |
| create a new node tree using the given XPath filter expression | |
| bool | delete_this () |
| delete current node and go back to previous position | |
| void | remove_children (const XS_String &name) |
| remove all children named 'name' | |
| void | erase (const XS_String &attr_name) |
| remove the attribute 'attr_name' from the current node | |
| XS_String & | str () |
| const XS_String & | str () const |
| void | set_property (const XS_String &key, int value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, double value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, const XS_String &value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, const struct XMLBool &value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, const char *value, const XS_String &name=XS_PROPERTY) |
Protected Member Functions | |
| void | go_to (XMLNode *child) |
| go to specified node | |
Protected Attributes | |
| XMLDoc | _msg |
| XMLNode * | _root |
| XMLNode * | _cur |
| std::stack< XMLNode * > | _stack |
Friends | |
| struct | const_XMLPos |
Reader for XML Messages.
Definition at line 4139 of file xmlstorage.h.
| XMLStorage::XMLMessageReader::XMLMessageReader | ( | const std::string & | xml_str, |
| const std::string & | system_id = std::string() |
||
| ) | [inline] |
Definition at line 4141 of file xmlstorage.h.
References _msg, and XMLStorage::XMLDoc::read_buffer().

| void XMLStorage::XMLPos::add_down | ( | XMLNode * | child ) | [inline, inherited] |
insert children when building tree
Definition at line 2219 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLNode::add_child(), and XMLStorage::XMLPos::go_to().
Referenced by XMLStorage::XMLPos::create(), and XMLStorage::XMLPos::smart_create().


| bool XMLStorage::XMLPos::back | ( | ) | [inline, inherited] |
go back to previous position
Definition at line 2226 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLPos::_stack.
Referenced by XMLRPC::XMLRPCParser::get_any(), XMLRPC::XMLRPCParser::get_array(), XMLRPC::XMLRPCParser::get_binary(), XMLRPC::XMLRPCParser::get_bool(), XMLRPC::XMLRPCParser::get_date(), XMLRPC::XMLRPCParser::get_double(), XMLRPC::XMLRPCParser::get_int(), XMLRPC::XMLRPCParser::get_parameter_types(), XMLRPC::XMLRPCParser::get_string(), XMLRPC::XMLRPCParser::get_struct(), XMLStorage::XMLPos::set_property(), test_delete(), test_read(), test_read1(), test_read2(), test_write(), xml_test(), and XMLRPC::XMLRPCResult::XMLRPCResult().
{
if (!_stack.empty()) {
_cur = _stack.top();
_stack.pop();
return true;
} else {
assert(!_stack.empty());
return false;
}
}

| int XMLStorage::XMLPos::count | ( | const XPath & | xpath ) | const [inline, inherited] |
count the nodes matching the given relative XPath expression
Definition at line 2329 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLNode::count().
Referenced by test_read().
{
return _cur->count(xpath);
}


| void XMLStorage::XMLPos::create | ( | const XS_String & | name ) | [inline, inherited] |
create node and move to it
Definition at line 2290 of file xmlstorage.h.
References XMLStorage::XMLPos::add_down().
Referenced by test_write(), xml_test(), and XMLStorage::XMLMessage::XMLMessage().
{
add_down(new XMLNode(name));
}


| void XMLStorage::XMLPos::create_node_content | ( | const XS_String & | node_name, |
| const XS_String & | content | ||
| ) | [inline, inherited] |
create node with string content
Definition at line 2296 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLNode::add_child(), and XMLStorage::XMLNode::set_content().
{
XMLNode* pNode = new XMLNode(node_name);
pNode->set_content(content);
_cur->add_child(pNode);
}

| bool XMLStorage::XMLPos::create_relative | ( | const XPath & | xpath ) | [inline, inherited] |
create child nodes using XPath notation and move to the deepest child
Definition at line 2279 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLNode::create_relative(), and XMLStorage::XMLPos::go_to().
{
XMLNode* node = _cur->create_relative(xpath);
if (!node)
return false; // invalid path specified
go_to(node);
return true;
}

| XMLNode& XMLStorage::XMLPos::cur | ( | ) | [inline, inherited] |
access to current node
Definition at line 2181 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur.
{
return *_cur;
}
| const XMLNode& XMLStorage::XMLPos::cur | ( | ) | const [inline, inherited] |
Definition at line 2186 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur.
{
return *_cur;
}
| bool XMLStorage::XMLPos::delete_this | ( | ) | [inline, inherited] |
delete current node and go back to previous position
Definition at line 2387 of file xmlstorage.h.
References XMLStorage::XMLNode::_children, XMLStorage::XMLPos::_cur, and XMLStorage::XMLPos::_stack.
Referenced by test_delete().
{
if (!_stack.empty()) {
XMLNode* pLast = _stack.top();
if (pLast->_children.remove(_cur)) {
_cur = _stack.top();
return true;
}
}
return false;
}

| void XMLStorage::XMLPos::erase | ( | const XS_String & | attr_name ) | [inline, inherited] |
remove the attribute 'attr_name' from the current node
Definition at line 2408 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLNode::erase().
Referenced by test_delete().
{
_cur->erase(attr_name);
}


create a new node tree using the given XPath filter expression
Definition at line 2335 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLNode::filter().
Referenced by test_read().
{
return _cur->filter(xpath, target);
}


| XS_String XMLStorage::XMLPos::get | ( | const XS_String & | attr_name, |
| LPCXSSTR | def = XS_EMPTY_STR |
||
| ) | const [inline, inherited] |
attribute access
Definition at line 2202 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLNode::get().
{
return _cur->get(attr_name, def);
}

| XS_String XMLStorage::XMLPos::get | ( | const T & | attr_name ) | const [inline, inherited] |
index operator attribute access
Definition at line 2214 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur.
{return (*_cur)[attr_name];}
| const XMLDoc& XMLStorage::XMLMessageReader::get_document | ( | ) | [inline] |
| bool XMLStorage::XMLPos::go | ( | const XPath & | xpath ) | [inherited] |
move to the position defined by xpath in XML tree
Definition at line 111 of file xmlstorage.cpp.
References XMLStorage::XPath::_absolute, XMLStorage::XMLPos::_cur, XMLStorage::XMLPos::_root, XMLStorage::XMLNode::find_relative(), and XMLStorage::XMLPos::go_to().
Referenced by test_read(), test_read1(), test_read2(), xml_test(), and XMLRPC::XMLRPCResult::XMLRPCResult().
{
XMLNode* node = xpath._absolute? _root: _cur;
node = node->find_relative(xpath);
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 2239 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLNode::get_first_child(), and XMLStorage::XMLPos::go_to().
Referenced by XMLRPC::XMLRPCParser::next_parameter(), test_delete(), test_read(), XMLRPC::XMLRPCParser::XMLRPCParser(), and XMLRPC::XMLRPCResult::XMLRPCResult().
{
XMLNode* node = _cur->get_first_child();
if (node) {
go_to(node);
return true;
} else
return false;
}


| bool XMLStorage::XMLPos::go_down | ( | const XS_String & | child_name, |
| int | n = 0 |
||
| ) | [inline, inherited] |
search for child and go down
Definition at line 2251 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XPathElement::find(), and XMLStorage::XMLPos::go_to().
{
XMLNode* node = XPathElement(child_name, n).find(_cur);
if (node) {
go_to(node);
return true;
} else
return false;
}

| void XMLStorage::XMLPos::go_to | ( | XMLNode * | child ) | [inline, protected, inherited] |
go to specified node
Definition at line 2433 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLPos::_stack.
Referenced by XMLStorage::XMLPos::add_down(), XMLStorage::XMLPos::create_relative(), XMLStorage::XMLPos::go(), XMLStorage::XMLPos::go_down(), XMLStorage::XMLPos::iterate(), and XMLStorage::XMLPos::smart_create().

| bool XMLStorage::XMLPos::iterate | ( | const XS_String & | child_name, |
| int & | cnt | ||
| ) | [inline, inherited] |
iterate to the next matching child
Definition at line 2263 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XPathElement::find(), and XMLStorage::XMLPos::go_to().
Referenced by XMLRPC::XMLRPCParser::get_parameter_types(), and XMLRPC::XMLRPCParser::next_parameter().
{
XMLNode* node = XPathElement(child_name, cnt).find(_cur);
if (node) {
go_to(node);
++cnt;
return true;
} else
return false;
}


| XMLStorage::XMLPos::operator const XMLNode * | ( | ) | const [inline, inherited] |
automatic access to current node
Definition at line 2192 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur.
{return _cur;}
| XMLStorage::XMLPos::operator XMLNode * | ( | ) | [inline, inherited] |
| const XMLNode& XMLStorage::XMLPos::operator* | ( | ) | const [inline, inherited] |
| XMLNode& XMLStorage::XMLPos::operator* | ( | ) | [inline, inherited] |
| const XMLNode* XMLStorage::XMLPos::operator-> | ( | ) | const [inline, inherited] |
| XMLNode* XMLStorage::XMLPos::operator-> | ( | ) | [inline, inherited] |
Definition at line 2215 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur.
{return (*_cur)[attr_name];}
| const XS_String& XMLStorage::XMLPos::operator[] | ( | const XS_String & | attr_name ) | const [inline, inherited] |
Definition at line 2216 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur.
{return (*_cur)[attr_name];}
| void XMLStorage::XMLPos::put | ( | const XS_String & | attr_name, |
| const XS_String & | value | ||
| ) | [inline, inherited] |
attribute setting
Definition at line 2208 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLNode::put().
Referenced by XMLStorage::XMLPos::set_property().
{
_cur->put(attr_name, value);
}


| void XMLStorage::XMLPos::remove_children | ( | const XS_String & | name ) | [inline, inherited] |
remove all children named 'name'
Definition at line 2402 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, and XMLStorage::XMLNode::remove_children().
{
_cur->remove_children(name);
}

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, |
| double | value, | ||
| const XS_String & | name = XS_PROPERTY |
||
| ) | [inline, inherited] |
Definition at line 3967 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLPos::back(), XMLStorage::XMLPos::smart_create(), XMLStorage::XS_KEY, and XMLStorage::XS_VALUE.
{
smart_create(name, XS_KEY, key);
XMLDoubleRef(_cur, XS_VALUE) = value;
back();
}

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, |
| const XS_String & | value, | ||
| const XS_String & | name = XS_PROPERTY |
||
| ) | [inline, inherited] |
Definition at line 3974 of file xmlstorage.h.
References XMLStorage::XMLPos::back(), XMLStorage::XMLPos::put(), XMLStorage::XMLPos::smart_create(), XMLStorage::XS_KEY, and XMLStorage::XS_VALUE.
{
smart_create(name, XS_KEY, key);
put(XS_VALUE, value);
back();
}

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, |
| int | value, | ||
| const XS_String & | name = XS_PROPERTY |
||
| ) | [inline, inherited] |
Definition at line 3960 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLPos::back(), XMLStorage::XMLPos::smart_create(), XMLStorage::XS_KEY, and XMLStorage::XS_VALUE.
{
smart_create(name, XS_KEY, key);
XMLIntRef(_cur, XS_VALUE) = value;
back();
}

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, |
| const char * | value, | ||
| const XS_String & | name = XS_PROPERTY |
||
| ) | [inline, inherited] |
Definition at line 2422 of file xmlstorage.h.
References XMLStorage::XMLPos::set_property().
Referenced by XMLStorage::XMLPos::set_property().
{set_property(key, XS_String(value), name);}


| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, |
| const struct XMLBool & | value, | ||
| const XS_String & | name = XS_PROPERTY |
||
| ) | [inherited] |
| void XMLStorage::XMLPos::smart_create | ( | const XS_String & | child_name ) | [inline, inherited] |
create node if not already existing and move to it
Definition at line 2304 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLPos::add_down(), XMLStorage::XPathElement::find(), and XMLStorage::XMLPos::go_to().
Referenced by XMLStorage::XMLPos::set_property(), and XMLStorage::XMLPos::XMLPos().
{
XMLNode* node = XPathElement(child_name).find(_cur);
if (node)
go_to(node);
else
add_down(new XMLNode(child_name));
}


| void XMLStorage::XMLPos::smart_create | ( | const XS_String & | child_name, |
| const XS_String & | attr_name, | ||
| const XS_String & | attr_value | ||
| ) | [inline, inherited] |
search matching child node identified by key name and an attribute value
Definition at line 2315 of file xmlstorage.h.
References XMLStorage::XMLPos::_cur, XMLStorage::XMLPos::add_down(), XMLStorage::XPathElement::find(), and XMLStorage::XMLPos::go_to().
{
XMLNode* node = XPathElement(child_name, 0, attr_name, attr_value).find(_cur);
if (node)
go_to(node);
else {
node = new XMLNode(child_name);
add_down(node);
(*node)[attr_name] = attr_value;
}
}

| XS_String& XMLStorage::XMLPos::str | ( | ) | [inline, inherited] |
| const XS_String& XMLStorage::XMLPos::str | ( | ) | const [inline, inherited] |
friend struct const_XMLPos [friend, inherited] |
Definition at line 2426 of file xmlstorage.h.
XMLNode* XMLStorage::XMLPos::_cur [protected, inherited] |
Definition at line 2429 of file xmlstorage.h.
Referenced by XMLStorage::XMLPos::add_down(), XMLStorage::XMLPos::back(), XMLStorage::XMLPos::count(), XMLStorage::XMLPos::create_node_content(), XMLStorage::XMLPos::create_relative(), XMLStorage::XMLPos::cur(), XMLStorage::XMLPos::delete_this(), XMLStorage::XMLPos::erase(), XMLStorage::XMLPos::filter(), XMLStorage::XMLPos::get(), XMLStorage::XMLPos::go(), XMLStorage::XMLPos::go_down(), XMLStorage::XMLPos::go_to(), XMLStorage::XMLPos::iterate(), XMLStorage::XMLPos::operator const XMLNode *(), XMLStorage::XMLPos::operator XMLNode *(), XMLStorage::XMLPos::operator*(), XMLStorage::XMLPos::operator->(), XMLStorage::XMLPos::operator[](), XMLStorage::XMLPos::put(), XMLStorage::XMLPos::remove_children(), XMLStorage::XMLPos::set_property(), XMLStorage::XMLPos::smart_create(), and XMLStorage::XMLPos::str().
XMLDoc XMLStorage::XMLMessageReader::_msg [protected] |
Definition at line 4153 of file xmlstorage.h.
Referenced by get_document(), and XMLMessageReader().
XMLNode* XMLStorage::XMLPos::_root [protected, inherited] |
Definition at line 2428 of file xmlstorage.h.
Referenced by XMLStorage::XMLPos::go().
std::stack<XMLNode*> XMLStorage::XMLPos::_stack [protected, inherited] |
Definition at line 2430 of file xmlstorage.h.
Referenced by XMLStorage::XMLPos::back(), XMLStorage::XMLPos::delete_this(), and XMLStorage::XMLPos::go_to().
1.7.2