rapidxml - is there is any way to get xml value by tag in rapid xml using c++ -


is there way value of tag tagname in rapidxml using c++

<?xml version=\1.0\ encoding=\latin-1\?> <book>example</book> <book1>example1</book1> 

i need book value ie example , book1 value ....we can use doc.first_node()->value() first node , next node need there way value get name

answer

xml_node<> *node = doc.first_node("book");       cout <<< node->value() << "\n"; 

you should able call first_node using node name matched. the docs:

function xml_node::first_node

synopsis

xml_node* first_node(const ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; description

gets first child node, optionally matching node name.

parameters

name

name of child find, or 0 return first child regardless of name; string doesn't have zero-terminated if name_size non-zero

name_size

size of name, in characters, or 0 have size calculated automatically string

case_sensitive

should name comparison case-sensitive; non case-sensitive comparison works ascii characters

returns

pointer found child, or 0 if not found.

rapidxml not support xpath richer queries though.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -