Solved

Display XML in Web Page

Posted on 2011-03-14
4
373 Views
Last Modified: 2012-05-11
I have picked up this project from someone else. We want to display the contents of an XML in a drop down list on a web page, however the lookup needs to be done server side.

The following code was taken from the global.asa file (sub Application_OnStart) and I want to output from this if poss:




set xmlHTTP = server.CreateObject("MSXML2.XMLHTTP")
	xmlHTTP.open "GET","depots.xml",false
	xmlHTTP.send
	dim openXmlDepots
	set openXmlDepots = server.CreateObject("MSXML2.FreeThreadedDomDocument.4.0")
	openXmlDepots.async = false
	openXmlDepots.loadXml(xmlHTTP.responsetext)
set application("XMLDepots") = openXmlDepots

Open in new window

0
Comment
Question by:Lico_w
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35130033
Can you post the XML and which elements you want to use for the value/text?
0
 

Author Comment

by:Lico_w
ID: 35130100
Attached xml
depots.xml
0
 

Author Comment

by:Lico_w
ID: 35130106
Also I want it to display the name but have the depot code as the value if poss
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 35130180
Ok. Try:
<%
Set dom = Application("XMLDepots")
Set nodes = dom.SelectNodes("/depots/depot")

Response.Write "<select>"

For Each node in nodes
     Response.Write "<option value=""" & node.Attributes.getNamedItem("dcode").Text & """>" & node.Attributes.getNamedItem("name").Text & "</option>"
Next

Response.Write "</select>"
%>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now