Changing the XML content

Im trying to send XML document as an attachment using SMTP in webmethods.
But the XML file has the content like Firstname “ampersand in symbol format” Lastname because it is fetched from database since xml does not allow this tag with ampersand error occurs.
I want to know how it can dynamically be changed in the Flow Service to Firstname & Lastname before emailing that document.

Any inputs will be of great help.

Thanks in Advance,


What you have to do when you use the recordToDocument(4.6) or XMLDocumentToXMLString(6.x) and set the input parameter encode=true the output xmldata will encode the ampersand to &in the xmldata.



   i agree with solomon try that.

I wonder why encode=true isn’t the default? I cannot think of a case where encode should be false (other than for efficiency when one is absolutely sure the source data will not have special chars).


If we set encode=true explicitly then only the output xmldata encoded as expected for special charectors(",>,< etc…)that is how the service works.


“If we set encode=true explicitly then only the output xmldata encoded as expected for special charectors(”,>,< etc…)that is how the service works."

I don’t understand what you’re trying to say. Can you rephrase? Do you have an example of when it is desirable to have encode=false?


Sorry for not clear.

Unless we set explicity encode=true,then only DocumentToXMLString xmldata output converts & to & and when encode=false it shows & symbol in the xmldata.

You may also check the same.


I see, you were describing the functionality of documentToXMLString. I think I have a pretty good handle on that.

My question was “why is false the default for encode?” IMO, having the default be false only creates problems–having ‘&’ (or any of the other characters that need to be converted to character entities) appear within XML is never valid. IMO, encode should default to true.

You are right encode should be default to true,but it not the way working right now.

Is there anything called XMLdocumentToXMLString in Webmethods 4.6 or anything similar to this.

In 4.6 it is recordToDocument service located in WmPublic/web folder.