Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
852
|
Chapter 15: XML
When the CDATA tag is used in conjunction with the InnerXml property of the
XmlElement class, you can submit characters that would normally need to be escaped
first. The
XmlElement class also has an InnerText property that will automatically
escape any markup found in the string assigned. This allows you to add these charac-
ters without having to worry about them.
See Also
See the “XmlDocument Class,” “XmlWriter Class,” “XmlElement Class,” and
“CDATA Sections” topics in the MSDN documentation.
15.8 Transforming XML
Problem
You have a raw XML document that you need to convert into a more readable for-
mat. For example, you have personnel data that is stored as an XML document and
you need to display it on a web page or place it in a comma-delimited text file for leg-
acy system integration. Unfortunately, not everyone wants to sort through reams of
XML all day; they would rather read the data as a formatted list or within a grid with
defined columns and rows. You need a method of transposing the XML data into a
more readable form as well as into the comma-delimited format.
Solution
The solution for this is to use an XSLT stylesheet to transform the XML into another
format using the
XslCompiledTransform class. In the example code, you transform
some personnel data from a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Joe Mayo
C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata