[Mono-bugs] [Bug 332714] New: Imvalid XML produced from program that relies on Microsoft' s forgiving implementation

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 10 14:28:50 EDT 2007


           Summary: Imvalid XML produced from program that relies on
                    Microsoft's forgiving implementation
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: tlillqvist at novell.com
         QAContact: mono-bugs at ximian.com
          Found By: ---

I had a look at some more corner cases to check how forgiving the .NET
implementation really is, and what Mono does in such cases.

The following program:

using System;
using System.Xml;

class Tml1 {
  public static void Main (string[] args)
    XmlTextWriter output = new XmlTextWriter (Console.Out);

    output.Formatting = Formatting.Indented;

    output.WriteStartDocument ();

    output.WriteStartElement ("element");
    output.WriteStartAttribute ("attribute");

    output.WriteStartElement ("element");

    output.Close ();
    Console.WriteLine ();

presumably uses System.Xml in an undefined way by "forgetting" to call
WeiteEndAttribute() and WriteEndElement(). Nevertheless it runs successfully on
NET and produces valid XML:

<?xml version="1.0" encoding="Windows-1252"?>
<element attribute="">
  <element />

When run with Mono (bleeding edge SVN), no exception is thrown, but it produces
invalid XML:

<?xml version="1.0" encoding="Windows-1252"?>
<element attribute="
  <element />

I guess one could argue that the program uses System.Xml in an undefined way,
so this is a case of garbage in, garbage out... but no doubt people will start
taking advantage of the looseness of the .NET implementation, so Mono should
work alike, I think.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list