Help accessing an XML document from a URL

T

TheDude5B

Hi, 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.

-------------------------------------------------------------------------------------------------------

<?xml version="1.0"?>
<clubnme>
<LONDON>
<venue>London KOKO</venue>
<address>1A Camden High Street, NW1</address>
<url>http://www.koko.uk.com</url>
<gig1>January 19th - The On/Offs</gig1>
<gig2>January 26th - The Envy Corps & Low Vs Diamond</gig2>
</LONDON>

<ABERDEEN>
<venue>Aberdeen Moshulu</venue>
<address>Windmill Brae, Aberdeen, AB11 6HU</address>
<url> </url>
<gig1>January 30th - Pop Levi</gig1>
<gig2>February 6th - Ratatat & the Whip</gig2>
</ABERDEEN>

<BIRMINGHAM>
<venue>Birmingham Custard Factory</venue>
<address>Gibb Square, Birmingham, B9 4AA</address>
<url> </url>
<gig1>January 25th - The Violets</gig1>
<gig2>February 1st - Ratatat</gig2>
</BIRMINGHAM>
</clubnme>

----------------------------------------------------------------------------------------------------------------

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 <city> tag and
is just displayed as <LONDON>, how would I access this data in XSL ?

Sorry for the long questiong, but I really need help with this now.

Thanks
 
A

Anthony Jones

TheDude5B said:
Hi, 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

<snip>

You've asked this question also in the XML group where it has been answered
please don't multipost. If you are unsure which group to post to use a
cross post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top