473,623 Members | 3,366 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)5 55-1212</value>
</attr>
</entry>
</directory-entries>
</dnt>

Oct 19 '06 #1
1 1331

ca*********@yah oo.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)5 55-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
2050
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.... and boxes under
3
4704
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 script: function makeIt() { var where = document.getElementsByTagName("TABLE").childNodes.childNodes.childNodes.childNodes; var base = document.getElementsByTagName("PRE"); var link = document.createElement("SPAN"); var text =...
1
2352
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 maintain a queue of flights numbers. the program will be abel 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
1
2193
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 -seach for a specific flight number in queue ( didn't get there yet) -move a flight number one one position in the queue to another ( didn't get there yet) this is what i have so far. it runs but something is wrong and i don't know what it is.
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 --------- name id categoryid
16
3240
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 not print in the username or email amddress of the person doing the download - which I am collecting from a form on the previous page. I can get the name and email address to print out normally, just not into the email sending body. I have...
6
1961
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 a little but I can't seem to get it to work. It attaches the file properly, but only displays the Plain Text message, even in an HTML-capable mail client. I'm guessing it has something to do with the placement of the boundaries,
3
1924
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 minbiketrader.com : Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/content/m/i/n/minibiketrader/html/index.php on line 2 Parse error: parse error, unexpected T_REQUIRE_ONCE in /home/content/m/i/n/minibiketrader/html/index.php on line...
8
3021
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, successfully authenticating against Active Directory, I send them from the login.php page to the index.php page. But when I get to the index.php page, the session ID is visible, but the session variables and values are not. Can you help me out? Also,...
0
8221
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8162
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8603
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8317
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8463
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6104
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1468
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.