[xml] question on namespace

Hi :
   I have the following code to create xml doc.
xmlDocPtr doc;
xmlNsPtr nsp;
xmlNodePtr root;
doc = xmlNewDoc(BAD_CAST "1.0");
nsp = xmlNewNs(NULL, BAD_CAST http://www.mycompany.com/NAME, NULL);
root = xmlNewNode(nsp, BAD_CAST "root_node");
xmlDocSetRootElement(doc, root);
if I call schema validation function and pass this xmlDocPtr, the validation will succeed. However, after calling xmlSaveFormatFileEnc(doc, "UTF-9", 1). The newly created file doesn't have namespace tag on it's root element.
so if I open this file and validate , it will fail.
I wonder why the default namespace I specified was saved into xml file ?
Thank you!

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