An error occurred while parsing EntityName. Line1, position 581

Recently I ran into this error for couple of times.

image.png

Both the times this issue was due to the ‘&’ character in the address field of the XML message being processed in BizTalk.

‘&’ is basically an invalid XML character along with following and should be replaced / encoded before using them in XML.

image

There is better / nicer way of achieving the same outcome by using SecurityElement.Escape method under System.Security namespace in .NET 4.5 and above.

image

Here Escape method will replace “&” with “&”. This method basically replaces invalid XML characters in a string with their valid XML equivalent.

So its always better to use this method while processing the address or other fields from XML message where the content of the field may contain invalid XML characters.

 Related links:

https://social.msdn.microsoft.com/Forums/en-US/c1c6b604-150c-4e0d-8b49-e2b4a1407c19/orchestration-xml-exception?forum=biztalkgeneral

http://stackoverflow.com/questions/7844410/escaping-only-contents-of-node-in-xml

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s