General discussion


Filling in a Form w/data from a XML file

By rheal.dugas ·
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")

Browser.Open "GET",URL,False

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 <ADDRESS>11111</ADDRESS> 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.
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Get infor from XML and place into the Form:
<form name="form1" method="post" action="">
<input name="textfield2" type="text" value=" <%=Address%>" />
Below is the XML file which is in the variable "GetStuff" that the first part of the code retreived.

<?xml version="1.0"?>
Can anyone Pleae help me with this.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by f-262417 In reply to Filling in a Form w/data ...

Have you checked XML data islands:

Just ignore the data-binding part from this article if its not needed.



Collapse -

by rheal.dugas In reply to

Poster rated this answer.

Collapse -

by tech786 In reply to Filling in a Form w/data ...

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


textfield2.innerText = xmlID.recordset("ADDRESS")
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

Collapse -

by rheal.dugas In reply to

Poster rated this answer.

Collapse -

by rheal.dugas In reply to Filling in a Form w/data ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums