Help accessing an XML document from a URL
am 23.01.2007 15:36:31 von TheDude5BHi, I have the following code which accesses an XML document and then
displays the document using XSL.
------------------------------------------------------------ -----------------------------------------------------------
Dim xmlDocument
Dim xslDocument
Dim path
Dim XSLTemplate
Dim proc
Dim nodes
set xmlDocument=CreateObject("MSXML2.FreeThreadedDOMDocument")
xmlDocument.async="false"
xmlDocument.load(Server.MapPath("test.xml"))
path="/forum"
set nodes = xmlDocument.selectNodes(path)
If nodes.length = 0 Then
Response.Redirect("noMatch.asp")
Else
set xslDocument=CreateObject("MSXML2.FreeThreadedDOMDocument")
xslDocument.async="false"
xslDocument.load(Server.MapPath("gigs.xsl"))
Set XSLTemplate =Server.CreateObject("MSXML2.XSLTemplate")
Set XSLTemplate.stylesheet = xslDocument
Set proc=XSLTemplate.createProcessor()
proc.input = xmlDocument
proc.Transform
Response.Write proc.output
End If
------------------------------------------------------------ ------------------------------------------------------------ ------------
The code works fine when I am loading the XML document from the local
server, but when I change the code to:
xmlDocument.Load("http://myurl.com/db/test.xml")
I seem to have problems. The browser seems to get stuck loading and
never returns any value, not even an error message.
Is this the correct way to load an XML document from a URL? Is there
some sort of server setting which may be blocking my code from access
this XML document?
.............................
Another Question.
.............................
Once I have solved this problem, I have another problem. The XML
document is not formed in a familiar way that I am used to, so I am
unsure of how to display it via XSL. The XML document looks like this.
------------------------------------------------------------ -------------------------------------------
1A Camden High Street, NW1
Windmill Brae, Aberdeen, AB11 6HU
Gibb Square, Birmingham, B9 4AA
------------------------------------------------------------ ----------------------------------------------------
I want to be able to display each part as City, Venue, Address, URL,
and then the gigs. But because the City is not within a
is just displayed as
Sorry for the long questiong, but I really need help with this now.
Thanks