I am pulling my hair out with what I would have thought would be a
relatively easy ASP / XML task.
There are TWO files, hosted on different physical servers. File1.asp
(server1) and XML-Result.xml (server2).
This is the exact XML markeup of XML-Result.xml (between the dotted lines):
------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://server2.com">Passing To John</string>
------------------------------------------------------------------
All I want to do is pull the "Passing To John" value to an ASP page, and
display it.
The ASP browser output would be:
------------------------------------------------------------------
The XML file contained:
Passing To John
------------------------------------------------------------------
Any ideas?
Regards,
Gary.
> This is the exact XML markeup of XML-Result.xml (between the dotted lines):
> ------------------------------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <string xmlns="http://server2.com">Passing To John</string>
> ------------------------------------------------------------------
>
> All I want to do is pull the "Passing To John" value to an ASP page, and
> display it.
Set XmlDocument = CreateObject("Msxml2.DOMDocument")
XmlDocument.async = False
If XmlDocument.load("http://example.com/result.xml") Then
Response.Write XmlDocument.documentElement.text
Else
' deal with parse error here e.g.
Response.Write XmlDocument.parseError.reason
End If
Depending on the version of MSXML you have on your server you might want
to set the ServerHTTPRequest property first
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/e5e05a5a-4895-47d7-82b1-3f1d2dec0ca5.asp>
e.g.
Set XmlDocument = CreateObject("Msxml2.DOMDocument")
XmlDocument.setProperty "ServerHTTPRequest", True
XmlDocument.async = False
If XmlDocument.load("http://example.com/result.xml") Then
Response.Write XmlDocument.documentElement.text
Else
' deal with parse error here e.g.
Response.Write XmlDocument.parseError.reason
End If
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
This is a perfect solution, works excellently. Thank you.
I am thinking about learning .NET - how would this code compare size wise?
Every example I have seen of .NET XML parseres seem to be much longer than
your code here. Shorter the better :)
Gary.