views:

210

answers:

1

I am trying to extend and tailor an external xsd schema (of the fixml standard). I need to change the data type of some of the elements, without touching the original schema, but by redefining it; but have been finding it exceedingly cumbersome.

What exists:

fields-base.xsd

<xs:simpleType name="LastUpdateTime_t">
           <xs:restriction base="UTCTimestamp">
<xs:simpleType>

what I want it to become:

<xs:simpleType name="LastUpdateTime_t">
           <xs:restriction base="xs:string">
<xs:simpleType>

What I have tried (but failed) :

<xs:redefine schemaLocation="fields-base.xsd">
            <xs:simpleType name="LastUpdateTime_t">
              <xs:restriction base="xs:string" />
            </xs:simpleType>
 </xs:redefine>

Books and net dont seem to have helped too much either, so I am starting to question if this is theoretically possible at all.

+2  A: 

As far as I can tell this is not possible.

The only redefine I could make validate in XMLSpy was:

<xs:redefine schemaLocation="fields-base.xsd"> 
        <xs:simpleType name="LastUpdateTime_t"> 
          <xs:restriction base="LastUpdateTime_t" /> 
        </xs:simpleType> 
</xs:redefine> 

That is, the new restriction must be based on the base restriction.

Could be that XMLSpy is wrong about this.

This somewhat cryptic quote from the W3C XML Schema definition:

Within the [children], each simpleType must have a among its [children] and each complexType must have a restriction or extension among its grand-[children] the ·actual value· of whose base [attribute] must be the same as the ·actual value· of its own name attribute plus target namespace;

might be talking about this (it is that part of the spec the XMLSpy links to for this error).

The only really good example of redefining simple types I could find was here. In this example, the redefinition is only for enumerations.

David Hall