General discussion

Locked

Filling in a Form w/data from a XML

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


<?xml version="1.0"?>
<RESULTS>
<NTFD>1111</NTFD>
<PRB><1111/PRB>
<NAME>11111</NAME>
<ADDRESS>1111111111</ADDRESS>
<CITYSTZIP>11111119</CITYSTZIP>
<CITY>11111</CITY>
</RESULTS>
-------------------------------------------
Can anyone Pleae help me with this.

This conversation is currently closed to new comments.

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

All Comments

Collapse -

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

If you can use ADO in your application you can open the XML into a recordset object and then move through that to get the data you need.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdconpersistingrecordsxmlformat.asp

The other open would be to open the XML into the XML Document Object and find the elements and/or attributes you need that way.

http://msdn.microsoft.com/XML/

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
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums