1

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.

Bill
  • 291
  • 3
  • 5
  • 14
  • 1
    It mentions "A URI string that references the file to load into a new XDocument" as a description for the parameter. – C.Evenhuis Jan 20 '14 at 15:29
  • 1
    Yes, is that only referring to a file? Does it also include a HTTP string? – Bill Jan 20 '14 at 15:44
  • 1
    See http://stackoverflow.com/questions/176264/whats-the-difference-between-a-uri-and-a-url - Uri's can be Url's – C.Evenhuis Jan 20 '14 at 15:45

1 Answers1

1

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.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110