B
bill
Hi All, I posted this originally to an xml group and got no response.
Hoping someone here has some insight.
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
(e-mail address removed) 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>[email protected]</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>
Hoping someone here has some insight.
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
(e-mail address removed) 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>[email protected]</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>