KB Article #178251

Unable to insert XML containing a namespace with Insert XML Node

Problem

When you attempt to insert an XML node containing a namespace, it is rejected with the error message: "The Node Content must contain valid XML for an Element node."

Resolution

Any namespace in the extract must be defined before the filter is able to insert them to ensure that the result is legal XML. By way of example, trying to insert something like this will fail:

<ns1:TokenType>TOKEN</ns1:TokenType>

Conversely, this will work:

<ns1:tokentype xmlns:ns1="http:⁄⁄xmlns.example.com/2000/01/ns">TOKEN</ns1:tokentype>

If you deal with a tool that does not allow namespaces to be redefined, you will have to work around that, either by using an XSLT reparse to remove the redefinition, or by using scripting to insert the XML to begin with, using the "Manipulate the Message Using the DOM API" sample in the scripting library as a starting place.