[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.

Boris Kirzner borisk at mainsoft.com
Thu Jan 15 02:19:22 EST 2004


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040115/3a880b07/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: XmlNode.cs.diff
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040115/3a880b07/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Class1.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040115/3a880b07/attachment-0001.pl 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040115/3a880b07/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: staff.xml
Type: text/xml
Size: 593 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040115/3a880b07/attachment.xml 


More information about the Mono-devel-list mailing list