问题
I am trying to parse through the contents of an xml file resident on a remote server in visual basic 6.0 using the MSXML2.DOMDocument
class.
I am using the Load
method of the MSXML2.DOMDocument
class to pass in the url. The url is of the form http://<server>/ABC.xml
, however, the server requires user credentials for accessing the file.
How do I pass in user credentials using this class or another supporting class?
回答1:
You can use http://<username>:<password>@<server>/ABC.xml
in many cases, or you can use the XMLHTTPRequest
helper object to make the actual requests.
Note that when you use an MSXML DOMDocument object you aren't parsing anything, the object does the heavy lifting. All you're doing is navigating the DOM tree, a trivial task by comparison.
来源:https://stackoverflow.com/questions/11212693/parsing-an-xml-document-at-a-remote-url-using-vb-6-0