简体   繁体   中英

Creating a xmlDoc using libxml2

Can anyone help me with how to create an xmlDoc using libxml2? I have a function:

xmlDocPtr createDocument()
{
   xmlDocPtr document;
   document = xmlNewDoc((const xmlChar*)"1.0"); // XML version


   return document;
}

The xml document should have the follow content:

<?xml version="1.0" encoding="utf-8?>
<rootNamespace::node xmlns:xsi="http://link1" xmlns:ism="abc" xmlns:rootNamespace="http://link2">
    <security ism:classification:"U" ism:ownerProducer="ABC" ism:releasableTo="ABC" />
    <one>message 1</one>
    ....
</rootNamespace::node>

Thanks for your help,

ABS

You could just take a look at libxml2's examples :

http://www.xmlsoft.org/examples/tree2.c

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