public XmlNode AddChild(XmlNode child)
{
if(child.ElementType == XmlElementType.XML_DOCUMENT_NODE)
{
throw new Exception("Document nodes cannot be added anywhere !");
}
// clear the cache as this /might/ be freed !
// I don't take no chances. (wild wild west)
if(child.ElementType == XmlElementType.XML_TEXT_NODE)
XmlNodeCache.Uncache(child.DeSerialize());
IntPtr retval=Native._xmlAddChild(dataPtr,child.DeSerialize());
if(retval == IntPtr.Zero)
{
throw new Exception("New node Could not be linked in !");
}
return XmlNodeFactory.NewNode(retval);
}