MARC.Everest.Xml Namespace
Classes within this namespace are used to facilitate the formatting of data to/from XML

Classes

  ClassDescription
Public classXmlStateReader An OnlineXmlReader that keeps track of its current state
Public classXmlStateWriter A OnlineXmlWriter that tracks its state

Remarks

The XmlStateWriter and XmlStateReader classes are wrapper for the OnlineXmlWriter and OnlineXmlReader classes respectively. These classes add the functionality of determining the path to the current element and thus, are used by formatters to report errors.

Examples

The following example illustrates the use of the XmlStateWriter

Getting the current path

Stream s = Console.OpenStandardOutput();
XmlStateWriter writer = new XmlStateWriter(XmlWriter.Create(s));

// Write the start of an HTML document
writer.WriteStartElement("html");
writer.WriteStartElement("body");

// currentPath will be "/html/body" 
string currentPath = writer.CurrentPath; 

writer.WriteStartElement("p"); 
// currentPath will be "/html/body/p"
currentPath = writer.CurrentPath; 

writer.WriteEndElement();
writer.WriteEndElement();
// currentPath will be "/html"
currentPath = writer.CurrentPath;

writer.WriteEndElement();