Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

Name

XmlWriter

Synopsis

This class is a fast writer used to output XML data to a stream or file. Two methods work with input from an XmlReader object to produce output from the currently positioned node. WriteAttributes() outputs all the node’s attributes. WriteNode() dumps the entire current node to the output stream and moves the XmlReader to the next node.

The remaining Write* methods of this class take string arguments that are output as properly formed XML markup. For example, WriteComment() takes a string and outputs it within <!-- ... --> markup. WriteStartAttribute() and WriteStartElement() provide some flexibility when writing elements and attributes. These two methods provide the opening contents of each type, given the name, prefix, and namespace. The next call can then provide the value of the element or attribute by other means. For example, you can use WriteString() for a simple string value, or another WriteStartElement() to begin a child element. WriteEndAttribute() and WriteEndElement() close the writing.

The derived XmlTextWriter class provides formatting functionality to the output data.

public abstract class XmlWriter {
// Protected Constructors
   protected method XmlWriter();  
// Public Instance Properties
   public abstract field WriteState WriteState{get; } 
   public abstract field string XmlLang{get; } 
   public abstract field XmlSpace XmlSpace{get; } 
// Public Instance Methods
   public abstract method void Close();  
   public abstract method void Flush(); public abstract method ...
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# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata