Solved

Display XML in Web Page

Posted on 2011-03-14
4
379 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

730 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