Im accepting a XMLnode back as input to my service. I see that you can use the encode parameter if you use documentToXMLString. The problem I have is that I only have a node. So the only thing I can run is XMLNodeToDocument. Obvsiouly because I have the special characters it blows up everytime. Can’t I convert the XMLNodetoXMLString? Im having issues receiving an XML document from a customer.
I can’t turn on encode because it does not exist going from XMLNodeToDocument.
It turns out they were. But when I went from XMLNodeToDocument it would get rid of the escape characters. Then I would do my updates and convert it back without setting the encode to true in the documentToXMLString service. Thanks for the help. Here is the flow people should be using if they want to catch a document routed from TN.
How to send a doc to TN: Input of service is node.
xmlNodeToDocument
MAP steps…
documentToXMLString (set encode to true)
XMLStringToXMLNode
wm.tn.doc.xml:routeXml
How to catch doc from TN and WriteToFile :Input of service is node.
Setting encode to true should be the default, IMO. I’m not sure why it is false. I guess avoiding encoding is good when one knows for certain that no characters that need encoding will be encountered. But this is a risky bet, IMO. Invariably, fields that “could never have an ampersand” (or any other special character) end up having one eventually.
Readers might consider adopting an “always set encode to true” policy.
I agree. Its confusing to me why encode itself is an optional field. I imagine there is a good reason just not for the uses that we use it for. There are a bunch of characters that the encode function escapes. We really needed to do it also because the business is expecting a “well formed” XML document, which this creates.