[xml] xmlwriter - include xml declaration <?xml version="1.0"?> in output



        


I am trying to write this declaration

<?xml version="1.0"?>

but cannot get it to be outputted the file i am writing. 


Am i missing something ? 


        xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");

xmlTextWriterPtr writer = xmlNewTextWriterTree( doc, NULL, 0 );

xmlTextWriterStartDocument(writer ,  "1.0" , NULL , "yes");

xmlTextWriterStartElement( writer, (const xmlChar *)"Node1" );

         // .. write inner xcontent 


        xmlTextWriterEndElement(writer) ; // node 1 

xmlTextWriterEndDocument(writer);

xmlFreeTextWriter(writer);

SerializeFile(doc);

xmlFreeDoc(doc); 




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