Yuki Kutsuya
Yuki Kutsuya

Reputation: 4088

C# Error in readering XML from URL

I have an XML reader but I receive an error when I'm trying to read the XML from an URL (external source).

This is the code I have ATM:

XmlReader xmlReader = XmlReader.Create("http://dl.bukkit.org/api/1.0/downloads/projects/craftbukkit/view/build-1330/");
        while (xmlReader.Read())
        {

        }

Very simple code, but it returns an error which says:

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

Any idea?
I can't edit the XML, because it's not mine.

Thanks in advance!

Upvotes: 3

Views: 297

Answers (1)

Gene
Gene

Reputation: 4232

If you use Fiddler to analyze the response returned by the sever, you'll see, that you get JSON instead of XML. You can add a parameter to the URL to get XML:

http://dl.bukkit.org/api/1.0/downloads/projects/craftbukkit/view/build-1330/?format=xml

Upvotes: 4

Related Questions