How do you use MSXML2::IXMLDOMDocument::save() to include line breaks and indents?
Cartoper wrote: > How do you use MSXML2::IXMLDOMDocument::save() to include line breaks > and indents? I don't think you can get the save method to indent. What you can do however is run an XSLT transformation to create an indentend document, then save that. The XSLT stylesheet to do that is as easy as <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Apply that with transformNodeToObject to transform the DOM document you have to a new DOM document, then call the save method on the result. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
A few months ago I asked a similar question and got a similar answer. I don't remember if there was more information in that thread but I know someone suggested use of a separate utility to reformat XML. "Cartoper" wrote in message news:ad25479e-b601-46a2-9826-0a169e7d150c@y38g2000hsy.googlegroups.com... > How do you use MSXML2::IXMLDOMDocument::save() to include line breaks > and indents? >