/// <summary> /// Write the document to an XML Writer. /// </summary> /// <param name="xmlWriter">An XML Writer.</param> public void WriteXml(XmlWriter xmlWriter) { // The XML Token Writer works much like an XmlWriter but it can accept Tokens as input and writes the fully qualified // name to the output device. XmlTokenWriter xmlTokenWriter = new XmlTokenWriter(xmlWriter); try { // Make sure that the Xsl Datastructure isn't modified while it is being written to the XML output device. this.stylesheet.readerWriterLock.AcquireReaderLock(Timeout.Infinite); // This will recursively scan through the entire data structure and create XML from the public data. if (this.stylesheet.stylesheetNode != null) { this.stylesheet.stylesheetNode.Save(xmlTokenWriter); } // Flush the writer when finished. xmlTokenWriter.Flush(); } finally { // The locks are no longer needed. this.stylesheet.readerWriterLock.ReleaseReaderLock(); } }
/// <summary> /// Write the SortedNodeList to the Xml Document. /// </summary> /// <param name="xmlTokenWriter">Represents a writer that provides a fast, non-cached, forward only means of generating /// streams or files containing XML data.</param> public override void Save(XmlTokenWriter xmlTokenWriter) { // Write each of the child elements out to the Xml Writer. foreach (Node node in this.orderableList) { node.Save(xmlTokenWriter); } }
/// <summary> /// Write the NodeList to the Xml Document. /// </summary> /// <param name="xmlWriter">Represents a writer that provides a fast, non-cached, forward only means of generating /// streams or files containing XML data.</param> public virtual void Save(XmlTokenWriter xmlTokenWriter) { // Write each of the child elements out to the Xml Writer. foreach (Node node in this) { node.Save(xmlTokenWriter); } }