Solved

Display XML in Web Page

Posted on 2011-03-14
4
374 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

777 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