XML parsing error: An invalid character was found in text content.

So I was writing a script to pull out some old xml data, and I happened upon this error:

XML parsing error: An invalid character was found in text content.

It probably would have taken me centuries to figure out what character it didn't like, so I tried concatenating the following line to the front of the xml column in the SELECT statement I used to populate the cursor for openxml, and voila, no more error!  I guess bumbles really do bounce.

'<?xml version=''1.0'' encoding=''iso-8859-1''?>'

 

Print | posted on Friday, June 29, 2007 11:26 AM

Comments on this post

# re: XML parsing error: An invalid character was found in text content.

Requesting Gravatar...
I was struggling with the same problem and I happened to google across your blog. It worked perfectly! Thanks!

- Ethan
Left by Ethan Nagel on Nov 01, 2007 7:02 AM

# re: XML parsing error: An invalid character was found in text content.

Requesting Gravatar...
Thank you.. works perfectly now :)
Left by ozzie on Nov 14, 2007 2:03 AM

# re: XML parsing error: An invalid character was found in text content.

Requesting Gravatar...
Thanks that worked for me as well!
Left by nashaad on Sep 09, 2008 8:32 PM

# re: XML parsing error: An invalid character was found in text content.

Requesting Gravatar...
Well, add me to the list. Made the change, and my program worked perfectly. Thanks so much!
Left by Bud on Nov 10, 2008 2:02 AM

# re: XML parsing error: An invalid character was found in text content.

Requesting Gravatar...
I am having exactly same error message: "An invalid character was found in text content. "
I tried having below code as first line of my xml file but it did not resolve my issue.
'<?xml version=''1.0'' encoding=''iso-8859-1''?>'
Do you think of any other cause and resolution of the same error message ?

Thanks,
Gaurang.
Left by Gaurang Thakkar on Nov 15, 2008 7:27 PM

Your comment:

 (will show your gravatar)
 
Please add 5 and 7 and type the answer here: