I know there is no direct method of doing it but still..
Can we convert XElement
element into XmlNode
.
Options like InnerText
and
I use the following extension methods, they seem to be quite common:
public static class MyExtensions
{
public static XElement ToXElement(this XmlNode node)
{
XDocument xDoc = new XDocument();
using (XmlWriter xmlWriter = xDoc.CreateWriter())
node.WriteTo(xmlWriter);
return xDoc.Root;
}
public static XmlNode ToXmlNode(this XElement element)
{
using (XmlReader xmlReader = element.CreateReader())
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);
return xmlDoc;
}
}
}