I'm migrating some code from using XmlDocument to using XDocument. As part of this code I need to add an element from one document into another document. With an XmlDocument I could do this using ImportNode, how do I do it with an XDocument?
There is no equivalent as XDocument doesn't have the notion of the document context that XmlDocument has.
You can simply add an XElement to the document, wherever that element came from.
See Alternative of <XMLdocument>.ImportNode on the MSDN forums.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With