Groups | Blog | Home
all groups > dotnet ado.net > august 2004 >

dotnet ado.net : Question on reading XML into a DataSet


Jitendra Khare via .NET 247
8/31/2004 12:57:20 PM
A stored procedure returns the following string - >
Note that there can be one or many "PlatformActivity" and within it "AffectedServers" can contain one or more "AffectedServer" element.

<?xml version="1.0" encoding="utf-8" ?>
<PlatformActivities>
<PlatformActivity xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<ActivityKey>-1</ActivityKey>
<ScheduledChangeDateTime>2004-08-31T17:09:00.0000000-04:00</ScheduledChangeDateTime>
<ChangeType>Replace existing hardware</ChangeType>
<ChangeDetails>xxxx</ChangeDetails>
<ChangeReason>xxx</ChangeReason>
<AffectedServers>
<AffectedServer>XA1DFIVR</AffectedServer>
<AffectedServer>XA1PBIVR</AffectedServer>
<AffectedServer>XA1PNIVR</AffectedServer>
<AffectedServer>XA1PAIVR</AffectedServer>
</AffectedServers>
<ImplementerName>xx</ImplementerName>
<RemedyTicketNumber>xx</RemedyTicketNumber>
<PMRNumber>xx</PMRNumber>
<PostImplementationComments>xx</PostImplementationComments>
<Status>In progress</Status>
<ActualDateTimeOfChange>2004-08-31T20:09:00.0000000-04:00</ActualDateTimeOfChange>
<CreatedBy>jkhare1</CreatedBy>
<ModifiedBy>jkhare1</ModifiedBy>
</PlatformActivity>
</PlatformActivities>

When I execute ds.ReadXml( stringReader ), the DataSet does contain two tables (PlatformActivity and AffectedServers) but there is always only one row in the AffectedServer table (which is the first "AffectedServer" element).

How do I get the AffectedServers table populate with ALL the "AffectedServer" elements?

Thanks in advance.

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Cor Ligthert
9/1/2004 1:33:39 PM
Jitendra,

When I see this right, you have one table "PlatformActivities" with a kind
of strange format inside. Because inside the table you have a table
"AffectedServers" with items "AffectedServer".

I am currious how you could did that that?

Cor


[quoted text, click to view]
<ScheduledChangeDateTime>2004-08-31T17:09:00.0000000-04:00</ScheduledChangeD
ateTime>
[quoted text, click to view]
<ActualDateTimeOfChange>2004-08-31T20:09:00.0000000-04:00</ActualDateTimeOfC
hange>
[quoted text, click to view]
tables (PlatformActivity and AffectedServers) but there is always only one
row in the AffectedServer table (which is the first "AffectedServer"
element).
[quoted text, click to view]

AddThis Social Bookmark Button