Experts Exchange connects you with the people and services you need so you can get back to work.
public class Sample
public static void Main()
//Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
//Create a deep clone. The cloned node
//includes the child node.
XmlDocument deep = (XmlDocument) doc.CloneNode(true);
//Create a shallow clone. The cloned node does not
//include the child node.
XmlDocument shallow = (XmlDocument) doc.CloneNode(false);
Console.WriteLine(shallow.Name + shallow.OuterXml);
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $168.80.
Premium members get this course for $95.20.
Premium members get this course for $151.20.
Premium members get this course for $159.20.
Premium members get this course for $108.00.