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; }
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; }
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)); } }
public XmlReader ReadSubtree() { return(node.ReadSubtree()); }