Avatar

Correct answer by
Level 10

Hi,

Considering you want the output as a string you could use XSLT, so something like (which copies all xml nodes except the NAME one);

var stylesheet =

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method = "xml" omit-xml-declaration = "yes" indent = "yes"/>   

        <xsl:template match="@*|node()">

            <xsl:copy>

                <xsl:apply-templates select="@*|node()"/>

            </xsl:copy>

        </xsl:template>

        <xsl:template match="NAME"/>

    </xsl:stylesheet>

var txt = $data.ELEMENT.applyXSL(stylesheet.toXMLString());    

console.println(txt)

You could also use;

$data.ELEMENT.nodes.remove($data.ELEMENT.NAME)

console.println($data.ELEMENT.saveXML("pretty"));

Regards

Bruce

View solution in original post