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);
}
}