The following is a small sample of my XML Data. When I
load it to a dataset it only loads the 'Zone' elements
and ignores loading the 'Field' elements.
<zone id="1234" name="EMPLOYMENT_INFO">
<field change-date="00:00:00:000" display="true"
editable="true" name="SBSB_CK"
valid="true">22514850</field></zone>
<zone id="1235" name="SUBSCRIBER_INFO">
<field change-date="00:00:00:000" display="false"
editable="true" name="SBSB_CK"
valid="true">22514850</field></zone>
I use XPath to extract my Nodes and I use the following
to put the extracted Nodes into a DataSet:
Dim zones As System.Xml.XmlNode = CType
(ni.Current,System.Xml.IHasXmlNode).GetNode()
CnvXML += zones.OuterXml
Add back the Hdr/Footer to make it a valid XML Document,
without this step it would not load the DataSet at all.
Dim XMLHdr, XMLFooter As String
XMLHdr = "<?xml version='1.0' encoding='utf-8'?><ROOT>"
XMLFooter = "</ROOT>"
sXML = XMLHdr + sXML + XMLFooter
I then load it into a DataSet;
Dim ds As DataSet = New DataSet
Dim nSR As StringReader = New StringReader(sXML)
Dim xmlRdr As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(nSR)ds.ReadXml(xmlRdr,
XmlReadMode.InferSchema)