简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM