![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - IXMLDOMDocumentPtr::save don't format output >Thread Next - Re: IXMLDOMDocumentPtr::save don't format output Re: IXMLDOMDocumentPtr::save don't format outputTo: NULL Date: 1/4/2005 5:06:00 PM Gorgen Givik wrote: > I have a problem: > IXMLDOMDocumentPtr::save don't format the output in a nice humanreadable > format like: > > <topLevel> > <nextLevel> > <myData> data </myData> > </nextLevel> > </topLevel> > > but more like this: > <topLevel><nextLevel><myData> data </myData></nextLevel></topLevel> > which is rather irritating because the users of my code is supposed to > change stuff in the file. > > I would be thankful if any of you have any suggestion how to solve that. If you load from a file with proper formatting and indentation then I am sure if you set xmlDocument.preserveWhiteSpace = true; before loading and then later save that the formatting is preserved. However if you construct a new document from scratch using DOM methods (e.g. createElement, createTextNode, appendChild) then indeed you need to ensure yourself that the document is properly formatted for saving. One way to do that is to use XSLT to format the document, this older post contains an XSLT 1.0 stylesheet doing that: <http://groups-beta.google.com/group/microsoft.public.dotnet.xml/msg/3545b35d0886d49c?dmode=source> Can't help you with C++ but perhaps you are able to transcribe the JScript code to C++ yourself. -- Martin Honnen http://JavaScript.FAQTs.com/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
