Re: [xml] xmlDocPtr save to file






Bjoern Hoehrmann wrote:

* AndrewHartley wrote:
I have a valid XML file loaded into an xmlDocPtr and would like to
successfully save to file.  When I use the xmlSaveToFilename:

[code]
  xmlSaveToFilename(szFilepath, NULL, 0);
[/code]

The file isn't succsfully written.  I would appreciate any helpful advice.

You don't pass any node to the function, so how would it know what you
want to save? xmlSaveToFilename creates a new xmlSaveCtxtPtr, you have
to use xmlSaveTree to actually save anything using the context.
-- 
BjÃrn HÃhrmann  mailto:bjoern hoehrmann de  http://bjoern.hoehrmann.de
Weinh. Str. 22 Â Telefon: +49(0)621/4309674 Â http://www.bjoernsworld.de
68309 Mannheim  PGP Pub. KeyID: 0xA4357E78  http://www.websitedev.de/ 
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




Thank you.  I worked it out now:
[code]
xmlSaveCtxtPtr ctxt = xmlSaveToFilename( szFilepath, NULL, 0 );
long ret = xmlSaveDoc( ctxt, m_pXmlDoc );
ret = xmlSaveClose( ctxt );
...
[/code]

-- 
View this message in context: http://www.nabble.com/xmlDocPtr-save-to-file-tp18319565p18320853.html
Sent from the Gnome - Lib - Xml - General mailing list archive at Nabble.com.




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