How can I use XML as a simple data storage in B开发者_C百科orland C++ Builder 6?
Is there an internal class, which I could use?
Thank's for help
I'm not sure whether the TXmlDocument
is implemented in C++Builder 6, but a more simple solution would be to use the TinyXML [1] library, which is indeed simple, and easy to use. I have used it with different versions of C++ Builder and it works like a charm.
[1] http://www.grinninglizard.com/tinyxml/
use NativeXML
xmlDoc = new TNativeXml("test");
xmlDoc->EncodingString = "GB2312" ;
xmlDoc->XmlFormat = xfReadable;
xmlNode = xmlDoc->Root->NodeNew("report") ;
xmlNode->WriteString("date","2008-6-8") ;
xmlNode->WriteString("road0","10") ;
xmlNode->WriteString("road1","8") ;
xmlNode = xmlDoc->Root->NodeNew("ctrParm") ;
xmlNode->WriteString("parm0","0") ;
xmlNode->WriteString("parm1","1") ;
xmlNode->WriteString("parm2","2") ;
xmlDoc->SaveToFile("test.xml") ;
delete xmlDoc ;
精彩评论