[Mono-devel-list] [PATCH] XmlNode.InsertBefore ,XmlNode.Appendchild and XmlNode.ReplaceChild should raise System.ArgumentException exception if the node to be put is one of this node's ancestors.

Atsushi Eno atsushi at ximian.com
Thu Jan 15 04:06:09 EST 2004


Yes you're absolutely right. It should raise HIERARCHY_REQUEST_ERR.
Thanks for nice patch again! Am going to commit.

(Maybe in the near future we might want to skip this procedure when it 
never occurs apparently e.g. on reading xml from XmlReader.)

Atsushi Eno

Boris Kirzner wrote:
> Description of Problem:
> XmlNode.InsertBefore ,XmlNode.AppendChild and XmlNode.ReplaceChild 
> should raise System.ArgumentException exception if the node to be put is 
> one of this node's ancestors.
> 
> 
> Steps to reproduce the problem :
> 1. Create XML file.
> 2. Load XML document into XmlDocument.
> 3. Try to insert/append/replace node child with one of the node's 
> ancestors.
> 
> Actual result :
> InsertChild - Expected exception not catched
> ReplaceChild - Exception catched : System.InvalidOperationException
> AppendChild - Expected exception not catched
> 
> 
> Expected result :
> InsertChild - Exception catched : System.ArgumentException
> ReplaceChild - Exception catched : System.ArgumentException
> AppendChild - Exception catched : System.ArgumentException
> 
> 
> Enclosed is a small test case and a patch.
> 
> Thank you in advance,
> 
> Boris Kirzner
> 
> 
> 
> 




More information about the Mono-devel-list mailing list