System.Xml.Xsl.Runtime.XmlQueryOutput.WriteItem C# (CSharp) Method

WriteItem() public method

Write an item to output. If currently constructing an Xml tree, then the item is always copied. At the top-level, the item's identity is preserved unless it's an atomic value.
public WriteItem ( XPathItem item ) : void
item System.Xml.XPath.XPathItem
return void
        public void WriteItem(XPathItem item) {
            if (item.IsNode) {
                XPathNavigator navigator = (XPathNavigator) item;

                // If this is a top-level node, write a reference to it; else copy it by value
                if (this.xstate == XmlState.WithinSequence)
                    this.seqwrt.WriteItem(navigator);
                else
                    CopyNode(navigator);
            }
            else {
                // Call WriteItem for atomic values
                Debug.Assert(this.xstate == XmlState.WithinSequence, "Values can only be written at the top-level.");
                this.seqwrt.WriteItem(item);
            }
        }