[xml] Empty element validation problem when extending simple type



Hi

I am getting a problem in validating xml when extending simple types.

My schema : (bugschema.xsd)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified" attributeFormDefault="unqualified">
       <xs:simpleType name="myDouble">
               <xs:union memberTypes="xs:double">
                       <xs:simpleType>
                               <xs:restriction base="xs:string">
                                       <xs:pattern value="\s*(N/A)?\s*"/>
                               </xs:restriction>
                       </xs:simpleType>
               </xs:union>
       </xs:simpleType>
       <xs:element name="element1" type="myDouble"/>
       <xs:element name="element2">
               <xs:complexType>
                       <xs:simpleContent>
                               <xs:extension base="myDouble">
                                       <xs:attribute name="att"
type="xs:string"/>
                               </xs:extension>
                       </xs:simpleContent>
               </xs:complexType>
       </xs:element>
</xs:schema>

XML File : (worksbugschema.xml)

<?xml version="1.0" encoding="UTF-8"?>
<element1/>

XML File : (notworksbugschema.xml)

<?xml version="1.0" encoding="UTF-8"?>
<element2 att="test"/>

Now when i validate using xmllint both files :

xmllint worksbugschema.xml --schema bugschema.xsd

<?xml version="1.0" encoding="UTF-8"?>
<element1/>
worksbugschema.xml validates


xmllint notworksbugschema.xml --schema bugschema.xsd


<?xml version="1.0" encoding="UTF-8"?>
<element2 att="test"/>
notworksbugschema.xml:2: element element2: Schemas validity error :
Internal error: xmlSchemaValidateFacetsInternal, validating 'pattern'
facet '\s*(N/A)?\s*' of type '#ST1'.
notworksbugschema.xml:2: element element2: Schemas validity error :
Internal error: xmlSchemaValidateSimpleTypeValue, validating facets of
atomic simple type '#ST1'
notworksbugschema.xml:2: element element2: Schemas validity error :
Internal error: xmlSchemaValidateSimpleTypeValue, validating members of
union simple type 'myDouble'
notworksbugschema.xml:2: element element2: Schemas validity error :
Internal error: xmlSchemaValidateComplexType, Element 'element2': Error
while validating character content against complex type '#CT3'.
notworksbugschema.xml:2: element element2: Schemas validity error :
Element 'element2': Internal error:
xmlSchemaValidateElementByDeclaration, calling validation by type.
notworksbugschema.xml:2: element element2: Schemas validity error :
Element 'element2': Internal error: xmlSchemaValidateElement, calling
validation by declaration.
notworksbugschema.xml fails to validate


The second one extends the simple type myDouble and its validation
fails. However if i use the extension base as xs:string or remove the
restriction pattern on myDouble the validation succeeds.


-Dhyanesh






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]