Question on reading XML into a DataSet

  • Thread starter Jitendra Khare via .NET 247
  • Start date
J

Jitendra Khare via .NET 247

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.
 
C

Cor Ligthert

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

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>
<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>
<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).
 
Top