Click to See Complete Forum and Search --> : Loading Labels from an XML source


Greg
10-23-2003, 02:55 PM
I have a pretty simple question that I would like to see someone else's approch
to. Let's take a simple XML document...

<Clients>
<Client ID="123-12-1234">
<FName>George<FName>
<MName>W</MName>
<LastName>Bush</LastName>
<Address>1600 Penn. Ave</Address>
</Client>
</Clients>

Now, I want to load this into an ASPX Web Page with a lot of labels. So,
I have a label name lblID, lblFName, lblMName, lblLastName, lblAddress.
I've been able to do some pretty neat things with automating this via FindControl().
So, I just loop through the XML and then find the control with the same
name. Of course, I append "lbl" to the name or "txt" if it's a TextBox.
Anyway, what I'm considering is to stop using the XMLDocument control and
use something else like a XMLReader or of course, ADO.Net. I think that
reading the XML and automating the work is neat, but I think the XMLDocument
has too large of an overhead. If so, what do you think I should be doing?
Should I try to load this into ADO.NEt and then naviagte the tables, columns,
rows, views, etc.? I'd guess that ADO.Net wouldn't ahave the overhead that
the XMLDocument would, but what about compared to the XMLReader control?

I want to make the app as robust and easy to maintain as possible. I like
the automated code because it makes my life very easy. As long as I name
the controls correctly, they hook up and work on there on. However, if it's
a performace hit, I'm not sure I want to do something that is neat over something
that is fast! My example is just something I made up to show you want I'm
doing, but the real XML documents can get pretty complex.

Any ideas or suggestions would be appreciated. I can't see to find too many
examples for anything like this except when binding controls. I'm not sure
if I should look at this approach when using a lot of labels.

Please offer some ideas. I just looking for other options.

Thanks for you time...

Greg