rapidxml first_node doesn't return null

Morphy

New Member
I'm trying to parse a XML file using RapidXML in C++, the file is like:\[code\]<root> <a> <b>1111</b> <c> <d1>2222</d1> <d2>3333</d2> </c> </a></root>\[/code\]To identify the parent nodes I'm doing:\[code\]if (currentNode->first_node() != 0) { // this node has children, search for them }\[/code\]It works fine for the two first nodes (root and a) but when I do this for node 'b' it returns a pointer to somewhere instead of 0, but 'b' doesn't have child nodes. Shouldn't it return 0? The RapidXML documentation says:function xml_node::first_nodeSynopsis\[code\]xml_node<Ch>* first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const;\[/code\]DescriptionGets first child node, optionally matching node name.Parametersname Name of child to find, or 0 to return first children regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero name_size Size of name, in characters, or 0 to have size calculated automatically from string case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters ReturnsPointer to found child, or 0 if not found. Any idea why this is happening or what I'm doing wrong?Thanks
 
Back
Top