473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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

Nov 19 '05 #1
1 2968
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)
"chrisn" <cn*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Douha | last post by:
Hi all, I have an XML file where all to elements for the data are contained in CDATA sections. I have a schema created that is working right now although it is pretty dumbed down. I have a need...
6
by: Mark Miller | last post by:
I have a scheduled job that uses different XSL templates to transform XML and save it to disk. I am having problems with the code below. The problem shows up on both my development machine (Windows...
3
by: Plumer | last post by:
Good morning everyone Using C# I create a bog-standard System.Data.DataTable which I then Add to a System.Data.Dataset (At the moment I'm in the guess-and-test phase so the table has only one...
2
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
3
by: Pat Alessi | last post by:
I want to use an XML data island to display editable records to a user on the cleint side. The user should be able to scroll through the records, modify any or all fields in any or all records, add...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
11
by: ericms | last post by:
Can anybody show me how to insert a CDATA section using XPathNavigator ? I have tried the follwing with no luck: XmlDocument docNav = new XmlDocument(); docNav.LoadXml(xmlString);...
4
by: werD | last post by:
Hello, Ive been reading about cdata-section-elements b/c ive got a comments field that id like to inlcude some html in. For some reason the final output is not including any cdata tags though?...
3
by: Ken Alexander | last post by:
Hello, I have a very simple xml file that I am reading into a DataSet using VB.NET. The problem I am having is setting my own unique IDs for the elements. After creating a DataSet of the below...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.