XML : XSD: xs:entity and xs:entities -- my entity works as an attribute but fails as an element

I have written a XSD and a conforming XML and now want to use predefined entities. Problem is that as soon as I use the xs:entity type, my XML elements are no longer conform to the XSD. My entity attributes work fine, but elements break.

I have the following minimal example of an XSD:

  <xs:schema xmlns="http://www.w3.org/2001/XMLSchema"   xmlns:xs="http://www.w3.org/2001/XMLSchema"       targetNamespace="http://www.example.com/xsdSimpleTypes"   xmlns:st="http://www.example.com/xsdSimpleTypes">      <xs:element name='simpleTypes' type="st:SimpleTypesType"/>      <xs:complexType name="SimpleTypesType">      <xs:sequence>        <!-- string -->        <xs:element name="test_ENTITIES" type="ENTITIES"/>        <xs:element name="test_ENTITY" type="ENTITY"/>      </xs:sequence>      <xs:attribute use="required" name="test_ENTITIES" type="ENTITIES"/>      <xs:attribute use="required" name="test_ENTITY" type="ENTITY"/>    </xs:complexType>  </xs:schema>    

and the following minimal XML file:

  <?xml version="1.0" encoding="UTF-8"?>  <!DOCTYPE schema [  <!ENTITY all_is_ok "all_is_ok">  ]>  <st:simpleTypes xmlns:st="http://www.example.com/xsdSimpleTypes"      test_ENTITIES="&all_is_ok;"      test_ENTITY="&all_is_ok;">      <test_ENTITIES>&all_is_ok;</test_ENTITIES>      <test_ENTITY>&all_is_ok;</test_ENTITY>  </st:simpleTypes>    

:: when I validate the xml against the XSD, libxml doesn't like the elements but the attributes are ok. (when I change the attributes content it also breaks, so it IS validating them :)

No comments:

Post a Comment