System.Xml.Xsl.Runtime.XmlMergeSequenceWriter.CopyShallowNode C# (CSharp) Method

CopyShallowNode() private method

Begin shallow copy of the specified node to the writer. Returns true if the node might have content.
private CopyShallowNode ( XPathNavigator nav ) : bool
nav XPathNavigator
return bool
        private bool CopyShallowNode(XPathNavigator nav) {
            bool mayHaveChildren = false;

            switch (nav.NodeType) {
                case XPathNodeType.Element:
                    this.xwrt.WriteStartElement(nav.Prefix, nav.LocalName, nav.NamespaceURI);
                    mayHaveChildren = true;
                    break;

                case XPathNodeType.Attribute:
                    this.xwrt.WriteStartAttribute(nav.Prefix, nav.LocalName, nav.NamespaceURI);
                    this.xwrt.WriteString(nav.Value);
                    this.xwrt.WriteEndAttribute();
                    break;

                case XPathNodeType.Text:
                    this.xwrt.WriteString(nav.Value);
                    break;

                case XPathNodeType.SignificantWhitespace:
                case XPathNodeType.Whitespace:
                    this.xwrt.WriteWhitespace(nav.Value);
                    break;

                case XPathNodeType.Root:
                    mayHaveChildren = true;
                    break;

                case XPathNodeType.Comment:
                    this.xwrt.WriteComment(nav.Value);
                    break;

                case XPathNodeType.ProcessingInstruction:
                    this.xwrt.WriteProcessingInstruction(nav.LocalName, nav.Value);
                    break;

                case XPathNodeType.Namespace:
                    this.xwrt.WriteNamespaceDeclaration(nav.LocalName, nav.Value);
                    break;

                default:
                    Debug.Assert(false);
                    break;
            }

            return mayHaveChildren;
        }