码迷,mamicode.com
首页 > 编程语言 > 详细

c++Builder XML

时间:2015-07-03 11:52:17      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

XMLDocument;

void CreateDocument() {
    _di_IXMLDocument document = interface_cast<Xmlintf::IXMLDocument>
        (new TXMLDocument(NULL));
    document->Active = true;
 
    // Define document content.
    document->DocumentElement = document->CreateNode("ThisIsTheDocumentElement",
        ntElement, "");
    document->DocumentElement->Attributes["attrName"] = "attrValue";
    _di_IXMLNode nodeElement = document->DocumentElement->AddChild
        ("ThisElementHasText", -1);
    nodeElement->Text = "Inner text.";
    _di_IXMLNode nodeCData = document->CreateNode("any characters here",
        ntCData, "");
    document->DocumentElement->ChildNodes->Add(nodeCData);
    _di_IXMLNode nodeText = document->CreateNode("This is a text node.",
        ntText, "");
    document->DocumentElement->ChildNodes->Add(nodeText);
 
    document->SaveToFile(destPath);
}

 

c++Builder XML

标签:

原文地址:http://www.cnblogs.com/cb168/p/4618015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!