DBC User <(E-Mail Removed)> wrote:
> As I explained before. I have a simple XML
> (http://tamil.taisukina.com/ServerReferenceTest.xml) which has only
> one. I am able to view the xml on the web page. But when I use the
> following code, I am getting "Illegal charaters in path" message on
> doc.Load
That's because it's trying to use the XML data itself as a URL. That's
not the way to go.
> I changed the Load to LoadXml then I get bad root message.
Right - that's the correct call to make - the problem is that the file
is essentially corrupt.
> Here is the sample code where I can make the code fail.
Thanks.
Okay, let's look at this. Firstly, if you try to load the URL into
Firefox or IE, they both fail in the same way. That's a strong
suggestion that it's not the code that's wrong (when you've changed
Load to LoadXml) but the file.
The first two characters of the file are U+FFEF (which is the byte
order mark) and 'X'. Now, the byte order mark confuses
XmlDocument.LoadXml, which is debatable behaviour, but the presence of
the 'X' is very puzzling. It really just shouldn't be there.
You need to work out why the file is broken in terms of the 'X' to
start with, and then either use the overload given by Richard or
manually strip out the BOM.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too