?
Solved

Display XML in Web Page

Posted on 2011-03-14
4
Medium Priority
?
387 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 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…
Suggested Courses

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