The most likely solution sounds like using XSLT and the identity template. You will have to add a matching template for any nodes you want to modify or edit:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!--
Templates to match nodes that need changing go here
-->
</xsl:stylesheet>
To remove the document element you must make sure that the new document is well formed or output as text. For example if your xml is:
Code:
<oldDocElement>
<newDocElement>
<data>Hello, World!</data>
</newDocElement>
</oldDocElement>
then add a template body to process oldDocElement:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!--
Templates to match nodes that need changing go here
-->
<xsl:template match="oldDocElement">
<xsl:apply-templates select="node()"/>
</xsl:template>
</xsl:stylesheet>
For details of how to use JavaScript to apply tranforms see the Ms xml 4 core services sdk at
http://msdn.microsoft.com/library/de...l/xmmscXML.asp
or better still download the docs from
http://msdn.com/xml.
--
Joe (Co-author Beginning XML, 3rd edition)