Discussion Locked

Filling in a Form w/data from a XML file

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a ASP page that contains a form which I want to populate with values from a XML file which I get from a MainFrame server.

I have the code to get the xml file and place it into a Variable that I named "GetStuff"

My problem is extracting the information from the XML and placing it into the form.

This is the code I use to get the information intop a XML file and put it into the "GetStuff" Variable. This code works well for me.
---------
<%
option explicit
Dim Browser,URL,ParseMe
Dim Address
Dim Getstuff
Dim objWinHttp
Set Browser = Server.CreateObject("WinHttp.WinHttpRequest.5")
URL="http://10.10.10.10:8000/impf/default.bas?cmd=get13screen&Version=XML&msn=111111111"

Browser.Open "GET",URL,False

Browser.Send
GetStuff=Browser.ResponseText
%>
--------------------
My XML contains 37 items. I have put in "1's" the fields.
Now I want to be able to get, lets say the information contained in the

11111
section and put it into a Form input area on my ASP page using the Variable "Address". I want to be able to do this for almost all the sections in the XML but if I can get one to work I can just duplicate it for the other sections
Here is the code.
-------

Untitled Document

Get infor from XML and place into the Form:

---------
Below is the XML file which is in the variable "GetStuff" that the first part of the code retreived.

1111
<1111/PRB>
11111
1111111111

11111119
11111

-------------------------------------------
Can anyone Pleae help me with this.

5 replies

by tech786

u can do it in 2 ways one is client side & the other is server side.
on client side need to define an XML Island & use windows.onLoad function to load it & use either the recordset method or the xml method to access the xml data & load the form variables. the code will look something similar as shown below

xmlID.loadXML(sXMLData)

textfield2.innerText = xmlID.recordset("ADDRESS")
OR
textfield2.innerText = xmlID.documentElement.selectSingleNode("ADDRESS").Text

repeat the same process for all the other nodes

Now on Server Side u can declare an xml dom object and used it to create the html script with the values

hope this helps

This discussion is closed to new replies.