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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82062 --- shadow/82062 2007-07-10 20:34:55.000000000 -0400 +++ shadow/82062.tmp.23789 2007-07-10 20:34:55.000000000 -0400 @@ -0,0 +1,102 @@ +Bug#: 82062 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: Unknown +Priority: Normal +Component: Sys.XML +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: XmlReaderSettings.IgnoreComments has no effect + +Description of Problem: +Setting XmlReaderSettings.IgnoreComments to true doesn't seem to have any +effect XmlNode methods like FirstChild and ChildNodes still return comment +objects. + +Steps to reproduce the problem: +Run the c# program below. + +Actual Results: +root + Bob + How did we get a #comment? + Ted + Sally + + +Expected Results: +root + Bob + Ted + Sally + + +How often does this happen? +Always. + +Additional Information: +-- Main.cs ------------------------ +using System; +using System.IO; +using System.Xml; +using System.Xml.Schema; + +public class Program +{ + public static void Main(string[] args) + { + XmlReaderSettings settings = new XmlReaderSettings(); + settings.IgnoreComments = true; // here's the bug + + Stream stream = File.OpenRead("Test1.xml"); + XmlReader reader = XmlReader.Create(stream, settings); + + XmlDocument xml = new XmlDocument(); + xml.Load(reader); + + DoElement(xml.FirstChild, ""); + } + + private static void DoElement(XmlNode element, string indent) + { + DoPrint(element, indent); + + foreach (XmlNode child in element.ChildNodes) + { + DoElement(child, indent + " "); + } + } + + private static void DoPrint(XmlNode element, string indent) + { + if (element.Name == "Customers" || element.Name == "Customer") + { + string name = element.Attributes["name"].Value; + Console.WriteLine("{0}{1}", indent, name); + } + else + Console.WriteLine("{0}How did we get a {1}?", indent, +element.Name); + } +} + +-- Test1.xml ---------------------- +<Customers name = "root"> + <Customer name = "Bob"> + </Customer> + + <!-- here's a customer --> + <Customer name = "Ted"> + </Customer> + + <Customer name = "Sally"> + </Customer> +</Customers> _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
