private Gecko.GeckoNode MakeGeckoNodeFromXmlNode(Gecko.GeckoDocument doc, XmlNode xmlElement)
{
var result = doc.CreateElement(xmlElement.LocalName);
foreach (XmlAttribute attr in xmlElement.Attributes)
result.SetAttribute(attr.LocalName, attr.Value);
foreach (var child in xmlElement.ChildNodes)
{
if (child is XmlElement)
result.AppendChild(MakeGeckoNodeFromXmlNode(doc, (XmlElement)child));
else if (child is XmlText)
result.AppendChild(doc.CreateTextNode(((XmlText) child).InnerText));
else
{
result = result;
}
}
return result;
}