Load CDATA Section into DataSet

monuindia2002

Member
Joined
Jan 26, 2006
Messages
8
Programming Experience
1-3
Hi
Is it possible to read a CDATA section from an xml file and load just a CDATA section into a dataset.
Example of XML file
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<msgName>schema</msgName>
</soapenv:Header>
<soapenv:Body>
<msgResponse>
<origMsgName> getSchema </origMsgName>
<msgStatus> PASS </msgStatus>
<response>
<msgText>
<Script>
<![CDATA[
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns=""xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="FORECAST_TYPE" msprop:BaseTable.0="FORECAST_TYPE">
<xs:complexType>
<xs:sequence>
<xs:element name="FORECAST_TYPE_CODE" msprop:OraDbType="126" msprop:BaseColumn="FORECAST_TYPE_CODE" type="xs:string" minOccurs="0" />
<xs:element name="CODE_DESC" msprop:OraDbType="126" msprop:BaseColumn="CODE_DESC" type="xs:string" minOccurs="0" />
<xs:element name="ASSIGNMENT_ID" msprop:OraDbType="107" msprop:BaseColumn="ASSIGNMENT_ID" type="xs:decimal" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
]]>

</Script>
</msgText>
<warnings>Warnings Text</warnings>
</response>
</msgResponse>
</soapenv:Body>
</soapenv:Envelope>
i just want to load this CDATA section form this XML file into a datset.

Regards
Mahesh
 
example reading all CDATAs into a string collection:
VB.NET:
Sub xmldoc()
  Dim xd As New Xml.XmlDocument
  xd.Load(Application.StartupPath & "\j.xml")
  childs(xd)
  For Each str As String In sl
    MsgBox(str)
  Next
End Sub
 
Dim sl As New Collections.Specialized.StringCollection
 
Sub childs(ByVal xn As Xml.XmlNode)
  If xn.HasChildNodes = True Then
    For Each ch As Xml.XmlNode In xn.ChildNodes
      childs(ch)
    Next
  End If
  If xn.NodeType = Xml.XmlNodeType.CDATA Then
    sl.Add(xn.InnerText)
  End If
End Sub
 
Back
Top