[Mono-bugs] [Bug 464394] New: System.Xml - XmlElement.SetAttribute(string, string) alters attribute sequence (undesirable behaviour)
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jan 8 06:17:12 EST 2009
https://bugzilla.novell.com/show_bug.cgi?id=464394
Summary: System.Xml - XmlElement.SetAttribute(string, string)
alters attribute sequence (undesirable behaviour)
Product: Mono: Runtime
Version: 2.0.x
Platform: x86
OS/Version: Windows XP
Status: NEW
Severity: Normal
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: erik_fuller at hotmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
For a node like
<MyNode Key="ABC" ClientName="xxx" DateIssued="yyy" />
The call
myNode.SetAttribute("Key", "");
will move the Key attribute to the end of the attribute list, like this
<MyNode ClientName="xxx" DateIssued="yyy" Key="ABC" />
This is a strange side effect and probably not desirable behaviour. The
overload SetAttribute (string localName, string namespaceURI, string value)
*does not* alter the sequence. Incidentally, the SetAttribute calls within the
Microsoft runtimes also do not alter the sequence.
---
Here's a brief rundown of the call stack leading to the issue
XmlElement.SetAttribute (string name, string value)
Attributes.SetNamedItem (attribute);
XmlAttributeCollection.SetNamedItem (XmlNode node)
XmlNode n = base.SetNamedItem (node, -1, false);
XmlNamedNodeMap.SetNamedItem (XmlNode node, int pos, bool raiseEvent)
nodeList.Remove (x);
if (pos < 0)
nodeList.Add (node);
You can see, the node with the same name is removed, then the new one is added
to the end of the list.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list