Home > Back-end >  Great god see, how to keep the XML parsing results into the TXT, two nodes to save line, how to writ
Great god see, how to keep the XML parsing results into the TXT, two nodes to save line, how to writ

Time:05-03

#include
#include
Using namespace STD.
# include "tinyxml. H"
Void parseXml (TiXmlNode * node) {for (TiXmlElement * nodeEle=node - & gt; FirstChildElement (); NodeEle!=nullptr; NodeEle=nodeEle - & gt; NextSiblingElement ()) {TiXmlNode * tempEle=nodeEle; If (nodeEle - & gt; The GetText ()!=NULL) {string tag=nodeEle - & gt; The Value (); The string content=nodeEle - & gt; GetText (); Cout & lt; <"Tag:" & lt; Int main ()
{string strfile; Cout & lt; <"The input XML file name:"; Cin & gt;> Strfile; TiXmlDocument doc (strfile c_str ()); If (doc. LoadFile ()) {parseXml (doc) RootElement ()); } the else cout & lt; <"No XML found!!!!!! "& lt; Is to save the tag and the content to the text, this how to write code?
  • Related