Xml/Xslt - XML Exception: Data at the root level is invalid. Line 1, position 1

Asked By karur krishna madhu on 31-Oct-12 04:27 AM

XML Exception: Data at the root level is invalid. Line 1, position 1. can anyone help me on this?

Michael Noam replied to karur krishna madhu on 31-Oct-12 05:21 AM
depends on which parser you're using.
Some parsers do not allow white spaces in the beginning of xmls.
Another option is the file encoding, are you parsing a file or a text string ?
karur krishna madhu replied to Michael Noam on 31-Oct-12 08:07 AM
Hi I am using UTF  8 encoding and i am parsing xml in the form of a string.
Michael Noam replied to karur krishna madhu on 31-Oct-12 08:10 AM
Did you try and see the string value in the debugger ?
I would also try calling trim on the xml string before parsing - likely this will solve the issue.
if you'd like you can send me the code and file and I'll see what's the exact issues.