Alex Rivera | Logout

XmlDocument.Load Vs XmlDocument.LoadXml

Asked 2009-11-02T11:16:05.987
24

I just came across with a problem using XmlDocument.LoadXml.

The application was crashing, giving the following error:

"Data at the root level is invalid. Line 1, position 1"

After inspecting the XML and finding nothing wrong with it, I googled a bit and found a tip to use XmlDocument.Load instead of XmlDocument.LoadXml.

I have tried it and it works perfectly.

My question is: What is the difference between the 2 methods and what could have cause one to work and the other to fail?

Edit
Report

1 Answer

4

Assuming your using XmlDocument.Load and XmlDocument.LoadXml in the right way this problem may be caused by Byte Order Mark.

This other question might be useful.

answered 2009-11-02T11:30:52.273

Your Answer