using pugixml to parse data using C++ but unable to get all the node attributes

GANGCHIL

New Member
I made a code that parse Function but it won't parse the Argument (name,type) My Code:\[code\]xml_node GCC_XML = doc.child("GCC_XML");{for (xml_node Function = GCC_XML.child("Function");Function; Function= Function.next_sibling("Function")){ cout<<"Function\n"<<"id= "<<Function.attribute("id").value()<<" , name= "<<Function.attribute("name").value()<<" ,returns: "<<Function.attribute("returns").value()<<Function.child_value("Argument") <<endl;}}\[/code\]That is the XML file i am trying to parse\[code\]<?xml version="1.0"?><GCC_XML> <Namespace id="_1" name="::" members="_2 _3 _4 "/> <Function id="_2" name="main" returns="_5" context="_1" location="f0:8"/> <Function id="_3" name="a_function" returns="_5" context="_1" location="f0:4"> <Argument name="f" type="_6"/> <Argument name="e" type="_4"/> </Function> <Struct id="_4" name="EmptyClass" context="_1" location="f0:1" members="_7 _8 " bases=""/> <FundamentalType id="_5" name="int"/> <FundamentalType id="_6" name="float"/> <Constructor id="_7" name="EmptyClass" context="_4" location="f0:1"> <Argument name="_ctor_arg" type="_9"/> </Constructor> <Constructor id="_8" name="EmptyClass" context="_4" location="f0:1"/> <ReferenceType id="_9" type="_4c"/> <File id="f0" name="example1.cxx"/></GCC_XML>\[/code\]The problem is that it refuse to read the functions arguments my results are :\[code\] Load result: No error Function id= _2 , name= main ,returns: _5 Function id= _3 , name= a_function ,returns: _5\[/code\]I also tried\[code\]cout<<"Function\n"<<"id= "<<Function.attribute("id").value()<<" , name= "<<Function.attribute("name").value()<<" ,returns: "<<Function.attribute("returns").value()<<Function.attribute("Argument") <<endl;\[/code\]put it gave the same result just added 0 output in the Argument output which show it doesn't read itPut i got the same results above
 
Back
Top