Praveen wrote:
> Trying to select a node 'E' from XML document 'ParentXML' and append the
> same to another xml document 'ChildXML'
>
>
> string MyXMLStr="<R><E A='1'/></R>";
> XmlDocument ParentXML= new XmlDocument();
> ParentXML.LoadXml(MyXMLStr);
>
>
>
>
> XmlDocument ChildXML = new XmlDocument();
> ChildXML.LoadXml("<R/>");
>
> XmlElement tempE = (XmlElement) ParentXML.DocumentElement.SelectSingleNode
> ("E");
>
> ChildXML.DocumentElement.AppendChild(tempE);
You need to use ImportNode
ChildXML.DocumentElement.AppendChild(ChildXML.ImportNode(tempE, true));
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/