简体   繁体   中英

XML in C++ Builder 6

How can I use XML as a simple data storage in Borland 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 ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM