SOAP Encoding Schema broken

I was working on the appendices regarding annotation of the graph with
respect to schema validation events this morning and while doing so realised
that the encoding schema has a serious problem.

We define complex types and global element decls for most of the built-in
schema types, adding optional id and ref attributes ( and allowing
attributes from other namespaces ). The problem with this approach is that
while it works fine for id ( the element which has the id still has
content ), it doesn't work for ref. Here's why; When an element has a ref
attribute, it's content should be empty. Unfortunately only a few of the
built-in schema types will validate this way ( string, normalizedString and
token ). All other types require that the content of the element be a valid
lexical form of the specified type, which will not be the case when ref is
present :-(

One solution to this problem is to define two types for each built-in. e.g.

  <xs:element name="double" type="tns:double" />
  <xs:complexType name="double" >
    <xs:simpleContent>
      <xs:extension base="xs:double" >
        <xs:attribute name='id' type='xs:ID' />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name='doubleRef' type='tns:doubleRef' />
  <xs:complexType name='doubleRef' >
    <xs:attribute name='ref' type='xs:IDREF' />
  </xs:complexType>

But this means that outbound edge labels depend on whether the node is
serialized in line or is referenced using the 'ref' attribute or xsi:type is
needed.


Another approach is to define a reference type and global element decl;

  <xs:element name='Reference' type='tns:Reference' />
  <xs:complexType name='Reference' >
    <xs:attribute name='ref' type='xs:IDREF' />
  </xs:complexType>

and say that all inbound edges for multi-refs are encoded as 'Reference'
elements. But again this forces particular edge names or xsi:type usage.

It's only a small stretch to then do this;

  <xs:element name='TypedReference' type='tns:TypedReference' />
  <xs:complexType name='TypedReference' >
    <xs:attribute name='ref' type='xs:IDREF' />
    <xs:attribute name='type' type='xs:QName' />
  </xs:complexType>

which has the advantage of carrying type info ( albeit app level ) with the
reference. Still has the same problems as the previous two regarding edge
names/xsi:type.

My inclination right now is to take the first approach and describe what
happens if the specified edge labels are used and what happens if the
specified edge labels are not used.

Thoughts, comments and other input to the usual address

Gudge

Received on Thursday, 25 April 2002 22:34:57 UTC