[Mono-bugs] [Bug 501814] New: Xml validation fails on complex content {content type} in some cases (patch included)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 7 11:16:27 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=501814


           Summary: Xml validation fails on complex content {content type}
                    in some cases (patch included)
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i686
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: jonas.larsson at manodo.se
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10)
Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10

The following validates flawlessly on .net, but not on mono. The problem is
different interpretations of 3.4.2 complex content {content type} in the specs.
Whatever one may think is "right" or "wrong" in this case, I think that
compatibility with .net is more important.

Test case:
-----------
string xsd = @"

  <xs:schema id='Layout'

  targetNamespace='foo'

  elementFormDefault='qualified'

  xmlns='foo'                  

  xmlns:xs='http://www.w3.org/2001/XMLSchema'>



  <xs:element name='Layout' type='Layout' />



  <xs:complexType name='Layout'>

   <xs:group ref='AnyLayoutElement' minOccurs='0' maxOccurs='unbounded' />

  </xs:complexType>



  <xs:group name='AnyLayoutElement'>

   <xs:choice>   

    <xs:element name='Label' type='Label' />   

    </xs:choice>

  </xs:group>



  <xs:complexType name='LayoutElement' abstract='true'>

    <xs:attribute name='id' type='xs:ID' use='optional' />

    <xs:attribute name='visible' type='xs:boolean' use='optional'
default='true' />

  </xs:complexType>



  <xs:complexType name='Label'>

   <xs:complexContent mixed='true'>

    <xs:extension base='LayoutElement'>

    <xs:attribute name='bold' type='xs:boolean' use='required'/>

    </xs:extension>

   </xs:complexContent>

   </xs:complexType>

   </xs:schema>";



   XmlDocument doc = new XmlDocument ();



   XmlSchema schema = XmlSchema.Read (XmlReader.Create (new StringReader
(xsd)), null);   



   doc.LoadXml (@"

  <Layout xmlns='foo'>

    <Label bold='false'>Text inside label</Label>

  </Layout>");

   doc.Schemas.Add (schema);

   doc.Validate (null);

------
On mono this fails with:
System.Xml.Schema.XmlSchemaValidationException: XmlSchema error: Not allowed
character content was found.


I will submit a patch for this when this report is submitted and I have gotten
a bug number.

Reproducible: Always

Steps to Reproduce:
Run above code
Actual Results:  
Exception

Expected Results:  
Sucessful validation

-- 
Configure bugmail: http://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