How to persist a dataset to XML using a CDATA field?

C

chrisn

I want to store text with HTML tags in an XML field, and to do this I
plan to use a CDATA field so that malformed HTML tags don't corrupt the
XML file structure (I have no control over the format of the HTML).

Rather than writing out the XML file explicitly, for simplicity I want
to write the data via a dataset that will then be persisted using
ds.WriteXML (and maybe reloaded via ds.ReadXML).

Can I set the dataset column that will hold the HTML text so that it is
written as type CDATA? Does this have to be specified in the XML
schema and if so how do I get WriteXML to write the data using this
schema?

Or is there some other way to do this?

Thanks,

ChrisN
 
B

Bruce Barker

if you store the html in a dataset column, and then use the datasets
WriteXml and ReadXml, you don't need to do anything. it will quote the html.

if you want to use cdata's instead of xml quoting, you will need to write
your own xml serilization for datasets.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top