I don’t think this is accurate. I cannot be certain as the screen shot does not show the full namespace declarations. But “pricePart” is either not in a namespace, and would have no prefix, or is in a default namespace, and would have no prefix. “hy” is not the namespace, it is the namespace prefix. I note this to emphasize that there are multiple ways that an element within a namespace can be represented. The lack of a prefix does not mean the namespace is removed.
For the purposes here, it is the namespace prefix that is undesirable. The key here is telling the xmlNodeToDocument service to change the prefix of a given namespace from whatever it is in the document the sender provided to be the prefix you want – which is nothing. The challenge as noted above is how to get the “nothing” defined in Designer – it really wants a var to have a name. I managed to do so some time ago. Here is a screen shot:
The trick is using the “Set a Value” button for the document and then “Add Row” for each namespace. For each namespace, use a literal space for the var name and paste the namespace as the value. Use 1 space for the first namespace, 2 spaces for the next, and so on. This is because they need to be uniquely named.
Here is the example XML I used to demonstrate:
<h:html xmlns:xdc="http://www.xml.com/books" xmlns:h="http://www.w3.org/HTML/1998/html4">
<h:head><h:title>Book Review</h:title></h:head>
<h:body>
<xdc:bookreview>
<xdc:title>XML: A Primer</xdc:title>
<h:table>
<h:tr align="center">
<h:td>Author</h:td><h:td>Price</h:td>
<h:td>Pages</h:td><h:td>Date</h:td></h:tr>
<h:tr align="left">
<h:td><xdc:author>Simon St. Laurent</xdc:author></h:td>
<h:td><xdc:price>31.98</xdc:price></h:td>
<h:td><xdc:pages>352</xdc:pages></h:td>
<h:td><xdc:date>1998/01</xdc:date></h:td>
</h:tr>
</h:table>
</xdc:bookreview>
</h:body>
</h:html>
Downside of this approach is you need to know all the namespaces (not the prefixes) ahead of time. And the funky setting of the nsDecls var. If you’re adventurous you could probably use queryXMLNode to get a list of the namespaces that are present in a given document, then dynamically create the nsDecls var so you wouldn’t need to know the namespaces ahead of time.
HTH.
#webMethods#Integration-Server#REST#SOAP#Integration-Server-and-ESB