http://bugzilla.novell.com/show_bug.cgi?id=560946
http://bugzilla.novell.com/show_bug.cgi?id=560946#c0 Summary: Moving an XmlAttribute from one XmlElement to another throws System.ArgumentException: This attribute is already set to another element. Classification: Mono Product: Mono: Runtime Version: 2.4.x Platform: x86 OS/Version: FreeBSD Status: NEW Severity: Normal Priority: P5 - None Component: JIT AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: Community User Blocker: No Description of Problem: In the .NET runtime an XmlAttribute can be moved from one XmlElement to another in the same XmlDocument by Appending it to the new XmlElement. It is automatically removed from the source, since a node can only have on instance in the document tree. In the Mono runtime this throws "System.ArgumentException: This attribute is already set to another element.". Steps to reproduce the problem: Instantiate this class: ============================= snip ============================= using System.Xml; /// <summary> /// Demonstrates attribute bug in Mono. /// </summary> /// <remarks> /// This does not cause an error in the .NET runtime. /// The attribute is moved from one element to another. /// To reproduce the bug in Mono, instatiate this class. /// </remarks> public class AttributeBug { public AttributeBug() { // make a document var xml = new XmlDocument(); // add a root element var band = xml.CreateElement("band"); xml.AppendChild(band); // give it an attribute var genre = xml.CreateAttribute("genre"); xml.DocumentElement.Attributes.Append(genre); // make another node var musician = xml.CreateElement("musician"); xml.DocumentElement.AppendChild(musician); /* * // this doesn't make a difference FWIW * band.Attributes.Remove(genre); */ // move the attribute // This line throws the exception. musician.Attributes.Append(genre); } } ============================= snip ============================= Actual Results: In the Mono runtime the exception is thrown with a stack trace like: System.ArgumentException: This attribute is already set to another element. at System.Xml.XmlAttributeCollection.SetNamedItem (System.Xml.XmlNode node) [0x00000] at System.Xml.XmlAttributeCollection.Append (System.Xml.XmlAttribute node) [0x00000] at AttributeBug..ctor (System.Xml.XmlNode node) [0x00000] Expected Results: The XmlAttribute node should move to the target element. How often does this happen? Consistently. Additional Information: Removing the XmlAttribute from the source XmlElement first does not alter the outcome. Workarounds: None. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
