[xml] need help with creating new xml file



I'm newbee to libxml  and i need to make a simple thing - create xml file.  After reading docs i realise 
that's very simple just 

#include <libxml/tree.h>
 
int main()
{
    xmlDocPtr doc;
    xmlNodePtr tree, subtree;
 
    doc = xmlNewDoc("1.0");
    doc->children = xmlNewDocNode(doc, NULL, "EXAMPLE", NULL);
    xmlSetProp(doc->children, "prop1", "gnome is great");
    xmlSetProp(doc->children, "prop2", "& linux too");
    tree = xmlNewChild(doc->children, NULL, "head", NULL);
    subtree = xmlNewChild(tree, NULL, "title", "Welcome to Gnome");
    tree = xmlNewChild(doc->children, NULL, "chapter", NULL);
    subtree = xmlNewChild(tree, NULL, "title", "The Linux adventure");
    subtree = xmlNewChild(tree, NULL, "p", "bla bla bla ...");
    subtree = xmlNewChild(tree, NULL, "image", NULL);
    xmlSetProp(subtree, "href", "linus.gif");
 
    return xmlSaveFile("new.xml", doc);
}

but when i try to complie this i was frustrated  by  error messages like this:

t.cpp:11: passing `const char *' as argument 1 of `xmlNewDoc(const xmlChar *)' changes signedness
t.cpp:12: passing `const char *' as argument 3 of `xmlNewDocNode(xmlDoc *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes signedness
t.cpp:13: passing `const char *' as argument 2 of `xmlSetProp(xmlNode *, const xmlChar *, const xmlChar *)' 
changes signednesst.cpp:13: passing `const char *' as argument 3 of `xmlSetProp(xmlNode *, const xmlChar *, 
const xmlChar *)' changes signednesst.cpp:14: passing `const char *' as argument 2 of `xmlSetProp(xmlNode *, 
const xmlChar *, const xmlChar *)' changes signednesst.cpp:14: passing `const char *' as argument 3 of 
`xmlSetProp(xmlNode *, const xmlChar *, const xmlChar *)' changes signednesst.cpp:15: passing `const char *' 
as argument 3 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const xmlChar *)' changes
signedness
t.cpp:16: passing `const char *' as argument 3 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:16: passing `const char *' as argument 4 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:17: passing `const char *' as argument 3 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:18: passing `const char *' as argument 3 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:18: passing `const char *' as argument 4 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:19: passing `const char *' as argument 3 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:19: passing `const char *' as argument 4 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:20: passing `const char *' as argument 3 of `xmlNewChild(xmlNode *, xmlNs *, const xmlChar *, const 
xmlChar *)' changes
signedness
t.cpp:21: passing `const char *' as argument 2 of `xmlSetProp(xmlNode *, const xmlChar *, const xmlChar *)' 
changes signednes

who tell me what's wrong with my head or may be with my hands ...




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]