Bill
Bill

Reputation: 291

xdocument.load (url) or (stream)

I am confused about xdocument.load.

I did a search and found MSDN XDOCUMENT.LOAD

It does not state that you can supply a URL as a load option, but you can and it does work by the many examples I found.

So, is this documented anywhere? Is it better to use WebResponse to get a stream?

I am confused, please help.

Upvotes: 1

Views: 1763

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167581

See MSDN:

The XmlUrlResolver class is the default resolver for all classes in the System.Xml namespace. It supports the file:// and http:// protocols and requests from the WebRequest class. In many cases, if you do not specify an XmlResolver object that your application should use, an XmlUrlResolver object with no user credentials is used to access XML resources.

So behind the simple APIs taking a string with a URI an XmlUrlResolver is used.

Upvotes: 1

Related Questions