[Mono-bugs] [Bug 422581] New: Xml schema validation fails to match required attribute in the root element .

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Sep 3 10:21:31 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=422581


           Summary: Xml schema validation fails to match required attribute
                    in the root element.
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: gorkempacaci at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


Created an attachment (id=237124)
 --> (https://bugzilla.novell.com/attachment.cgi?id=237124)
xml data, schema and csharp code to reproduce the exception.

Tested in Mono 2.0 RC1.

The validation seems to fail to find the required attribute on the root
element. It only happens in this specific case:

"The first child of the root element has a child which has an attributed child,
and the root also has another child."

The xml document seems like this:
<root foo="1">
  <dummy>
      <bar>
          <elmnt name="value" />
      </bar>
  </dummy>
  <dummy2></dummy2>
</root>

And the schema:
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
  <xs:complexType>
    <xs:sequence>
      <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"
namespace="##any"/>
    </xs:sequence>
    <xs:attribute name="foo" type="xs:integer" use="required" />
  </xs:complexType>
</xs:element>
</xs:schema>

* If you remove the element 'dummy2', validation passes.
* If you move the 'dummy2' above 'dummy', validation passes.
* If you remove the attribute 'name' from the element 'elmnt', validation
passes.
* Currently it's throwing the exception at the end of the xml document. But if
the root node has multiple child nodes, the exception points to the endelement
of one of those child nodes. 

You can find the xml data, schema and the code to reproduce the exception in
the attached file. When you execute the attached csharp code, you get this
exception:
Unhandled Exception: System.Xml.Schema.XmlSchemaValidationException: XmlSchema
error: Required attribute foo was not found. XML  Line 8, Position 4.


-- 
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