[Mono-bugs] [Bug 501666] New: XmlSchemaValidator fails on simple types derived from positiveInteger and other integer types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 7 05:37:27 EDT 2009


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


           Summary: XmlSchemaValidator fails on simple types derived from
                    positiveInteger and other integer types
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        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

I'll let the following code speak for itself:
--------------------

  string xsd = @"
  <xs:schema id='Settings'
    targetNamespace='foo'        
    xmlns='foo'
    xmlns:xs='http://www.w3.org/2001/XMLSchema'>

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

    <xs:complexType name='Settings'>
      <xs:attribute name='port' type='PortNumber' use='required'/>
    </xs:complexType>

    <xs:simpleType name='PortNumber'>
      <xs:restriction base='xs:positiveInteger'>
    <xs:minInclusive value='1'/>
    <xs:maxInclusive value='65535'/>
      </xs:restriction>
    </xs:simpleType>
  </xs:schema>";

  string xml = @"<Settings port='1337' xmlns='foo'/>";

  XmlDocument doc = new XmlDocument ();
  doc.LoadXml (xml);
  doc.Schemas.Add (XmlSchema.Read (XmlReader.Create (new StringReader (xsd)),
null));
  doc.Validate (null);

------------

Run result on mono:

System.InvalidCastException : Conversion from schema type foo:PortNumber (type
code Decimal) to String is not supported

I must say that I think this conversion should succeed :-)


Reproducible: Always

Steps to Reproduce:
Run above code
Actual Results:  
InvalidCastException

Expected Results:  
Successful 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