Пример #1
0
        public XmlSubtreeReader(IXmlNode node, string rootLocalName, string rootNamespaceUri)
        {
            if (null == node)
                throw Error.ArgumentNull("node");
            if (null == rootLocalName)
                throw Error.ArgumentNull("rootLocalName");

            this.reader           = node.ReadSubtree();
            this.rootLocalName    = reader.NameTable.Add(rootLocalName);
			this.rootNamespaceURI = rootNamespaceUri ?? string.Empty;
        }
Пример #2
0
        public XmlSubtreeReader(IXmlNode node, string rootLocalName, string rootNamespaceUri)
        {
            if (null == node)
            {
                throw Error.ArgumentNull("node");
            }
            if (null == rootLocalName)
            {
                throw Error.ArgumentNull("rootLocalName");
            }

            this.reader           = node.ReadSubtree();
            this.rootLocalName    = reader.NameTable.Add(rootLocalName);
            this.rootNamespaceURI = rootNamespaceUri ?? string.Empty;
        }
Пример #3
0
        public static void CopyTo(this IXmlNode source, IXmlNode target)
        {
            using (var reader = source.ReadSubtree())
            {
                if (!reader.Read())
                {
                    return;
                }

                using (var writer = target.WriteAttributes())
                    writer.WriteAttributes(reader, false);

                if (!reader.Read())
                {
                    return;
                }

                using (var writer = target.WriteChildren())
                    do
                    {
                        writer.WriteNode(reader, false);
                    }while (!(reader.EOF || reader.NodeType == XmlNodeType.EndElement));
            }
        }
Пример #4
0
 public XmlReader ReadSubtree()
 {
     return(node.ReadSubtree());
 }