473,508 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: Pre-poulating a web form with xml data

Hi All, New to asp.net here. Been combing google since monday trying to
find the right solution. Most of the solutions are good and reflect the
same examples in the .net books I have but xml is sketchy to me and
this isn't you typical real world project.

Here's the scenario. I query an api via a URL and it responds with xml
data which I need to use to prepoulate the fields of a web form. I
haven't been able to get my head around this one. As you can see from
the XML example below, all of the elements I am after (name, address,
phone etc) have the same element name "attr". I have no control over
the xml document so I can't arrange the tags in a more useful manner.
If you look at the xml, I need to assign each value to a corresponding
textfield on a web form. So the value of attr name="mail" which is
jd**@msn.com must be assign to txtMail.text. So far I have been able to
return all of the values but I have not been successful in linking them
to that childnode (if thats correct) of name, mail, address etc.

Also should mention I can't really use an array solution like attr[1],
attr[2] which will work, but as I said I have no control over the xml
doc and if the positions change my app is hosed.

My deadline is tomorrow so thank you sincerely for any and ALL
suggestions.

BK

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE dsml (View Source for full doctype...)>
- <dnt complete="true">
- <directory-entries>
- <entry id="A0236721002">
- <attr name="name">
<value>John Doe</value>
</attr>
- <attr name="mail">
<value>jd**@msn.com</value>
</attr>
- <attr name="address">
<value>123 Some Street</value>
</attr>
- <attr name="city">
<value>New York</value>
</attr>
- <attr name="state">
<value>NY</value>
</attr>
- <attr name="zip">
<value>10019</value>
</attr>
- <attr name="phone">
<value>(212)555-1212</value>
</attr>
</entry>
</directory-entries>
</dnt>

Oct 19 '06 #1
1 1328

ca*********@yahoo.com wrote:
Hi All, New to asp.net here. Been combing google since monday trying to
find the right solution. Most of the solutions are good and reflect the
same examples in the .net books I have but xml is sketchy to me and
this isn't you typical real world project.

Here's the scenario. I query an api via a URL and it responds with xml
data which I need to use to prepoulate the fields of a web form. I
haven't been able to get my head around this one. As you can see from
the XML example below, all of the elements I am after (name, address,
phone etc) have the same element name "attr". I have no control over
the xml document so I can't arrange the tags in a more useful manner.
If you look at the xml, I need to assign each value to a corresponding
textfield on a web form. So the value of attr name="mail" which is
jd**@msn.com must be assign to txtMail.text. So far I have been able to
return all of the values but I have not been successful in linking them
to that childnode (if thats correct) of name, mail, address etc.

Also should mention I can't really use an array solution like attr[1],
attr[2] which will work, but as I said I have no control over the xml
doc and if the positions change my app is hosed.

My deadline is tomorrow so thank you sincerely for any and ALL
suggestions.

BK

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE dsml (View Source for full doctype...)>
- <dnt complete="true">
- <directory-entries>
- <entry id="A0236721002">
- <attr name="name">
<value>John Doe</value>
</attr>
- <attr name="mail">
<value>jd**@msn.com</value>
</attr>
- <attr name="address">
<value>123 Some Street</value>
</attr>
- <attr name="city">
<value>New York</value>
</attr>
- <attr name="state">
<value>NY</value>
</attr>
- <attr name="zip">
<value>10019</value>
</attr>
- <attr name="phone">
<value>(212)555-1212</value>
</attr>
</entry>
</directory-entries>
</dnt>
BK,

Hope you managed to hit your deadline. Would be interested to see how
you resolved this.

I have written a seris of forms that can be pre-populated with XML
data. The simplest solution I could come up with to use XSL to
generate the HTML form. Although I have the advantage that the XML is
controlled by me. An XSD (XML definition) file is always very useful
when you rely on someone elses XML. This will show you the layout of
the document, as the developer designed it, and could give you some
insight in to how to work with it.

The XML snip you present doesn't look very well defined. If you know
who does control the XML output I would suggest they read some books or
check the internet on using XML and presenting it as API output. If
this is a published API (internal or external) the format shouldn't
change without pre-warning.

Steve

Oct 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2045
by: rk | last post by:
Hi, I'm trying to write a cgi/perl programs to post a report like the following format in which the the user has to feed the values(nos) in the boxes under % Done Qual Rel. Stab P1 p2 P3.......
3
4691
by: Dante | last post by:
Tonight I started writing a script that places a "Copy All" link before every PRE tag. The link would copy the code in the pre tag. I can't get this script to work. Can anyone help me? Here is my...
1
2336
by: aemazing | last post by:
hello, im new to the forum and i wanted to help with my c++ program. the teacher wants us to design a progrm that would keep track of airplanes awaitin landing at an airport. the program will...
1
2188
by: aemazing | last post by:
i've been tryin to do the following - -Add a new flight number to the end of the queue (got it done) -LAnd the plane at the front of the queue - problems wit it- -display the queue - got it done...
4
320
by: ungahz | last post by:
hi all. im having a problem and wondering if anyone an help. i have the following tables along with column names (too many columns so im just including the relevent ones): folders ---------...
16
3222
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
6
1959
by: Karl Groves | last post by:
I'm trying to work out a mail system which can send an attachment as well as an HTML formatted message (and a default plain text version). I found some pretty good code on PHP.net and modified it...
3
1920
by: deerhide | last post by:
Hi, I was updating my website, well trying to... and I somehow messed it up. I didnt build it, I bought it so I don't know alot about programming. I receive these errors when going to...
8
3017
by: Eddie | last post by:
I am having difficulty in setting variables in a session, and then accessing those variables throughout the web pages that they click on. After having them set a user name and password,...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.