public XmlNode SaveToXmlNode() { var ms = new MemoryStream(); var xdoc = new XmlDocument(); SaveCore(ms); ms.Seek(0, SeekOrigin.Begin); xdoc.Load(ms); return xdoc.DocumentElement; }