Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

email article
printer friendly
get the code

Map DataSet Elements to CDATA Sections
Does your data contain reserved XML characters? Preserve it "as is" when pulling it from the database.
by Dan Wahlin

Posted April 21, 2003

In version 1.0 of .NET, DataSets do not provide an internal MappingType that allows element data to be wrapped with a CDATA section when XML is generated. This can present a problem when data pulled from the database contains reserved XML characters such as < because the DataSet GetXml() and WriteXml() methods escape these characters (< becomes &lt;). This demo shows how you can map DataSet elements to CDATA sections using a custom class named CDATAGenerator. Doing so helps preserve data "as is" rather than convert some of it into entities.

ADVERTISEMENT


Download the example here, originally from the XML for ASP.NET Developers site.

About the Author
Dan Wahlin authored XML for ASP.NET Developers (Sams) and founded Wahlin Consulting, which focuses on XML and Web Service consulting and training. Dan also operates the XML for ASP.NET Developers Web site: www.XMLforASP.NET. Find more information at http://www.xmlforasp.net/Dan.aspx.

Back to top












Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTP Home