XML Programming in C#
XML Programming in C#
E. J. Jones
Robert J. Oberg
William W. Provost
Student Guide
Revision 2.1
Student Guide
Information in this document is subject to change without notice. Companies, names and data
used in examples herein are fictitious unless otherwise noted. No part of this document may be
reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose, without the express written permission of Object Innovations.
Product and company names mentioned herein are the trademarks or registered trademarks of
their respective owners.
Object Innovations
877-558-7246
www.objectinnovations.com
Chapter 1
Objectives
XML
Parsing XML
Parsing Techniques
Parsing Example
System.Object
XmlWriter XmlReader
XmlTextWriter XmlTextReader
XmlNodeReader
XmlValidatingReader
XmlTextWriter Demo
tw.WriteStartElement("Car");
//Write the Make of the Car element
tw.WriteStartElement("Make");
tw.WriteString("AMC");
tw.WriteEndElement();
XmlDocument Demo
6. Now, what have we just learned? By default the parser will not
resolve entities; it is in an interactive read state; the parser is not
at the end of the file; the encoding is UTF8; language is
English; and the parser will preserve whitespace.
hasFeature = oDomParser.Implementation.HasFeature(
"XML", "1.0");
textBox1.AppendText( "XML 1.0 : " +
hasFeature.ToString() + Environment.NewLine);
hasFeature = oDomParser.Implementation.HasFeature(
"XML", "2.0");
textBox1.AppendText( "XML 2.0 : " +
hasFeature.ToString() +
Environment.NewLine) ;
}
Summary