DataSet & Xml

  • Thread starter Thread starter Josh
  • Start date Start date
J

Josh

Hi,

Is it possible for a DataSet to read and write CDATA section to/from xml?
Is there a way to cause all text fields being exported from an sqlce db
table to be in CDATA sections?

thanks
Josh
 
Yes, DataSet can read CDATA sections from XML. Content of CDATA will be
treated as text.
For example, this XML can be loaded:

<DS>
<xs:schema id="DS" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:element name="DS"
msdata:IsDataSet="true"><xs:complexType><xs:choice minOccurs="0"
maxOccurs="unbounded"><xs:element
name="Table"><xs:complexType><xs:sequence><xs:element name="Column"
type="xs:string" minOccurs="0"
/></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType><
/xs:element></xs:schema>
<Table>
<Column><![CDATA[CDATASECTIONGOESHERE]]></Column>
</Table>
</DS>

No, DataSet can not write CDATA sections to XML. This is how it would look
if you load XML above into the DataSet and save it:

<DS><xs:schema id="DS" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:element name="DS"
msdata:IsDataSet="true"><xs:complexType><xs:choice minOccurs="0"
maxOccurs="unbounded"><xs:element
name="Table"><xs:complexType><xs:sequence><xs:element name="Column"
type="xs:string" minOccurs="0"
/></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType><
/xs:element></xs:schema>
<Table>
<Column>CDATASECTIONGOESHERE</Column>
</Table>
</DS>

There's no standard API to export SQL CE DB into the XML.
You can use SqlCeDataReader to read data from SQL CE and save it manually
in any format you need (XML with CDATA, binary, CSV, etc.).

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Back
Top