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); }
public XmlNode AddChild(XmlNode child) { // clear the cache as this /might/ be freed ! // I ain't taking no chances. (wild wild west) if(this.GetFirstChild()!=null) { throw new Exception("Cannot add more that one child to a XmlDoc"); } 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); }