Ampersand in the XML tag


I am trying to send a XML to my flow service. I have used queryXMLNode to get the values of the tags. In one of my tag, i have “&”.
When i try to send XML to my flow service with such value, it gives me an error as “element is missing end tag”.
Sample tag,

<abc>test & test</abc>

Is it that we cannot use “&” in our xml tag content. Doesnot seems good.

Please suggest.


& in XML is invalid. It needs to be converted to the corresponding entity representation i.e. &

Hi Sandip,

You have to encode those type of characters(& and ‘). U have to use HTMLEncode format before you send to services, like “&” "’". It should fix that.

While this is certainly invalid XML, a document should be able to consume this character. Review XML reserve characters and escape characters. Using escape characters you should be able to process your document.

Jim Palmer

I have the same similiar problem as well. But for me, I face that problem when i send back the information which i receive from my source back to my client.

ie. Assuming my Client system, (System A) requests information from System B, based on a particular person’s ID. (in an XML, via HTTP)
System B returns the information back to me (in an XML, via HTTP).
But when i send the information back to System A (again in an XML, via HTTP), i face ‘ampersand’ error.
My client system displays the message of ‘element is missing end tag’.

How do i solve this?


Either replace all occurence of ampersand with <ampersand>amp<semicolon>. This would help you to solve the problem. Or u could do HTML encoding as mentioned above.