[Mono-bugs] [Bug 76312][Wis] New - XML id is buggy
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sat Oct 1 14:08:20 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by s.ros at evaluant.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76312
--- shadow/76312 2005-10-01 14:08:20.000000000 -0400
+++ shadow/76312.tmp.12194 2005-10-01 14:08:20.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 76312
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com
+ReportedBy: s.ros at evaluant.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: XML id is buggy
+
+Note: This is a clarification of bug #76309
+
+Description of Problem:
+When I create dynamically an XML node making use of the ID capabilities
+in XML it can happen that this id is not taken into account. If you add
+the attribute and only then affect its value, this value is not taken
+into account. Instead, if you set the value of the attribute before
+adding the attribute to the element then it is taken into account.
+
+Steps to reproduce the problem:
+Here is an application which shows the issue. It works under
+Microsoft .NET but not under Mono. I also commented the code which works
+to show where exactly is the issue.
+The XML file I use is the one created for the bug #76309
+
+using System;
+using System.Xml;
+
+class Class1
+{
+ static void Main(string[] args)
+ {
+ string filename = "76309.xml";
+ string id = "myId";
+
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (filename);
+
+ XmlElement entityNode;
+ doc.DocumentElement.AppendChild(entityNode =
+doc.CreateElement("Entity"));
+
+ XmlAttribute entityType = entityNode.Attributes.Append
+(doc.CreateAttribute("Type"));
+ entityType.Value = "Person";
+
+ // This code doesn't work
+ XmlAttribute entityId = entityNode.Attributes.Append
+(doc.CreateAttribute("Id"));
+ entityId.Value = id;
+
+ // This code works fine
+ // XmlAttribute entityId =
+doc.CreateAttribute("Id");
+ // entityId.Value = id;
+ // entityNode.Attributes.Append(entityId);
+
+ Console.WriteLine(doc.SelectNodes("id('" + id
++ "')").Count == 1);
+ Console.WriteLine(doc.GetElementById(id) != null);
+ }
+}
+
+
+Actual Results:
+False & False
+
+Expected Results:
+True & True
+
+How often does this happen?
+Always
More information about the mono-bugs
mailing list