I want to read that XML file and store it into the local strings variable in c++
Can anyone help me in how to do this in c++ programing ? an also please provide some useful links to learn how to program for reading XML through 开发者_如何学编程C++ in windows.
An easy library for reading / writing XML is tinyxml. It's a very practical tool, widely-used.
Use libxml2 it's very easy to work on Handling Xml files
http://xmlsoft.org/tutorial/index.html
As suggested in the title if you just want to load the file to a String :
ustring data;
char line[1000];
memset(line, 0, 1000);
char *retVal = NULL;
while ((retVal = fgets(line, 1000, incomingFileHandle)) != NULL)
{
data += line;
}
The easiest way for a beginner to read (parse) XML, is to use MSXML DOM A Beginner's Guide to the XML DOM and sample code Parsing an XML file in a C/C++ program, SAX or XmlLite: XmlLite Samples. You can use other libraries for XML handling, such as Xerces: Xerces, Wikipedia page.
精彩评论