RE: LC124: Ignore Unknowns, some proposed text

Jonathan wrote:

> Isn't one of the advantages of Henry's mechanism is that it the
> results
> are predictable and therefore interoperable?  For instance, given a
> schema for the structure:
> 
>   <name>
>     <first/>
>     <last/>
>   </name>
> 
> And a message instance of:
> 
>   <name>
>     <first/>
>     <last/>
>     <last role="alternate-spelling"/>
>   </name>
> 
> Henry's algorithm should predictably trim one (the last I think)
> <last/>
> element.  I can imagine a reasonable algorithm that trims the first.

That's a good point and does nicely expose a hole in my text.

There's an anticipation (on my part) that the additional content will 
be sent as a result of a backwards compatible change in the schema.

In this example, the v2 schema that accepts and processes both
the v1 and v2 messages, but with the optional additional 'last'
in the middle  would have to look something like:

    <xs:complexType name="nameType">
        <xs:sequence>
            <xs:element name="first" />
            <xs:element name="last" minOccurs="0" />
            <xs:element name="last" />           
        </xs:sequence>
    </xs:complexType>

or: 

    <xs:complexType name="nameType">
        <xs:sequence>
            <xs:element name="first" />
            <xs:any />
            <xs:element name="last" />           
        </xs:sequence>
    </xs:complexType>

or:

    <xs:complexType name="nameType">
        <xs:all>
            <xs:element name="first" />
            <xs:element name="last" maxOccurs="2" />        
        </xs:sequence>
    </xs:all>

I suspect writing a v2 schema in which the unexpected 
element appears ahead of the expected element with the same name
is not possible in XML Schema 1.0 without breaking UPA. 
All of the above are invalid Schema 1.0 examples.

> Which actually brings forth another question:  The schema is primarily
> used for code generation, and for mapping the data to that code.
> Given
> the above example, which <last/> will be mapped to code?  Especially
> if the following is also allowed:
> 
>   <name>
>     <first/>
>     <last role="alternate-spelling"/>
>     <last/>
>   </name>
> 

Once again, I can't see how to write the v2 schema for this example, apart
from making role optional (and ignored) on the v1 'last' element and having
the second 'last' being optional.

> Do we need Henry's algorithm in play for extracting data from the
> message, as well as for the optional validation step?  That would
> introduce a mandatory validation step in all messages, which could be
> undesirable.

That would be undesirable, hence my wanting to prescribe how unknowns
can be easily ignored by a 'ignoreUnknowns' aware processor.

I am wondering how much would have to be added to my proposed 
text to become precise, and would that precision just become another
way of wording Henry's technique.  

One way forward could be to add a line requiring there to be a compatible
schema which represents both the v1 and v2 messages. I'll think some more
on this ahead of tomorrow's call.

Paul

Received on Wednesday, 15 June 2005 19:43:48 UTC