Solved

Display XML in Web Page

Posted on 2011-03-14
4
370 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
Comment Utility
Can you post the XML and which elements you want to use for the value/text?
0
 

Author Comment

by:Lico_w
Comment Utility
Attached xml
depots.xml
0
 

Author Comment

by:Lico_w
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

762 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

6 Experts available now in Live!

Get 1:1 Help Now