XSV and enumeration of QName

My understanding of the enumeration facet is that it works on the value
space. Hence the following schema;

<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'
            xmlns:tns='urn:example-org:windows'
            targetNamespace='urn:example-org:windows'
            xmlns:xx='urn:foo:bar' xmlns:yy='urn:foo:baz'
            xmlns:zz='urn:foo:quux' >

  <xsd:simpleType name='myWindows'>
    <xsd:restriction base='xsd:QName'>
      <xsd:enumeration value='xx:1234' />
      <xsd:enumeration value='xx:5678' />
      <xsd:enumeration value='yy:1234' />
      <xsd:enumeration value='zz:1234' />
   </xsd:restriction>
  </xsd:simpleType>

  <xsd:element name='windows'>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name='window' maxOccurs='unbounded'>
          <xsd:complexType>
            <xsd:attribute name='model' type='tns:myWindows' />
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

should validate the following instance;

<p:windows xmlns:p='urn:example-org:windows' xmlns:a='urn:foo:bar'
xmlns:b='urn:foo:baz' xmlns:c='urn:foo:quux' >
  <window model='a:1234' />
  <window model='b:1234' />
  <window model='a:5678' />
  <window model='c:1234' />
</p:windows>


Note that the prefixes used in the instance are not the same as the prefixes
used in the schema. XSV complains, giving;

<invalid char='3' code='cvc-attribute.1.2' line='2'
resource='file:/C:/gxmlstuff/window.xml'>attribute type check failed for
{None}:model: a:1234 not in enumeration [u'1234']</invalid>

which looks to me as if it is checking the lexical space rather than the
value space...

I tried checking against MSXML 4 but it won't even read the schema doc :-(

Regards

Martin Gudgin
DevelopMentor

Received on Monday, 28 May 2001 06:48:44 UTC