c++ XML file parsing problem -


Hello everybody is my problem, I want to parse a XML file, I just want to change the unit value like

In my name, I type a code in my name c ++ which is the following

  #include & lt; String & gt; # Include & lt; Iostream & gt; # Include & lt; Sstream & gt; # Include & lt; Stdexcept & gt; # Include & lt; List & gt; # Include & lt; Sys / types.h & gt; # Include & lt; Sys / stat.h & gt; # Include & lt; Unistd.h & gt; # Include & lt; Errno.h & gt; #include "/usr/local/include/xercesc/parsers/SAXParser.hpp" #include "/usr/local/include/xercesc/sax/HandlerBase.hpp" #include "/ usr / local / include / xercesc / util / XMLString.hpp "using namespace std; Using the name space xercesc; Int main (int argc, char * args []) {XMLPlatformUtils :: Initialize (); Char * xmlFile = "/home/manish/conf/mapred-site.xml"; Cout & lt; & Lt; XmlFile; SAXParser * pars = new SAXParser (); Parser-> SetDoNamespaces (true); // Optional document handler * docHandler = new handler (); Error Handler * errHandler = (ErrorHandler *) docHandler; Parser-> SetDocumentHandler (docHandler); Parser-> SetErrorHandler (errHandler); Parser-> Parse (xmlFile); The court's & lt; & Lt; Parser-> GetRootGrammar (); Pars removal; Delete DockHandler; Return 0; }   

From my side I just saw an address I do not know what to do now? How to use this address? What is pointing to iit? What should I do to change the parameters of the XML file, in which my XML file

    

I want to change "myname" in "name" in this file

Can anyone tell me how to do this?

If this is all you really want to do, why do not you just replace some searches and strings Are: "Tag" by example. Then search for the next "" and "tag" tag after you use it.

The above code is WRT: As I mentioned in my, you can not use SAX to modify the XML document. In fact, in your code, you are not defining handler for your specific XML document, so how do you expect it to work? I suggest that you sit and try to understand the Sachs Parser example in examples.

Comments