Re: References to a value of an element in another element?

There are others in the schema workgroup who probably are more expert in 
the details, but here's my understanding of what is likely to be provided 
in Schema 1.1 with respect to the question you ask.  I should emphasize 
that the workgroup has no official position on such things until working 
drafts are formally published, and being on an airplane at the moment I 
don't have easy access to our last public draft.  With those caveats, I 
think what's likely to happen is:

All implementations of Schema 1.1 will be required to support a minimum 
subset of XPath 2.0, but MAY support more.  I believe that the operations 
you will need to access the "size" in your example and treat it as an 
integer (as opposed to a string of digits) will be in the minimum subset. 
I'm not an XPath expert, but my understanding is that XPath 2.0 itself 
does also provide for computing the "length" of an item such as your 
"data", but that XPath functions that do so may not be in the minimum 
subset.  If I've got that right, Schema processors will not necessarily 
support the XPaths you need, but some may.  (Others would just indicate 
that they could not handle the schema and declined to do a validation -- I 
don't think any would risk erroneously reporting as valid a 
schema/instance pair that violated the uncheckable assertion.)

I personally have mixed feelings about the lack of interoperability that 
results from allowing variation in what conforming processors support, but 
compared to insisting on just the mimum, it has the advantage that you may 
be able to find a Schema 1.1 processor that does what you want.

Again:  none of this is a commitment from the Schema WG as to what will be 
in either upcoming working drafts or final Recommendations for Schema 1.1, 
but I think a design like the above is reasonably likely to emerge unless 
we get negative reviews from the community during the evaluations that 
lead to finalizing the Recommendation.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








Carl Eric Codere <cecodere@yahoo.ca>
Sent by: xmlschema-dev-request@w3.org
01/26/2007 12:38 AM
Please respond to ccodere
 
        To:     Pete Cordell <petexmldev@tech-know-ware.com>, 
xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Re: References to a value of an element in another 
element?




--- Pete Cordell <petexmldev@tech-know-ware.com> wrote:

> Original Message From: "Carl Eric Codere"
> > Greetings,
> >         I have a simple question, but i am not sure it is possible to
> > represent  it in XMLSchema, if so any help would be really 
appreciated.
> >
> > I have variable-length structure and the length of the 2nd element
> depends 
> > on
> > the value of the first element. How is it possible to specify this in
> > XMLSchema?
> >
> > <xsd:complexType name="Chunk">
> >    <xsd:sequence>
> >      <xsd:element name="size"   type="xsd:integer"/>
> >      <xsd:element name="data"  type="xsd:hexBinary" ?????/>
> >    </xsd:sequence>
> >  </xsd:complexType>
> >
> > The problem is with element "data", how do i specify that its length 
is 
> > the
> > value "size"???
> 
> I'm afraid this is not possible in XML Schema alone.  Including 
additional 
> Schematron constraints may be able to help.
> 
> (FWIW - XSD 1.1, that is currently being developed, supports 
co-constraints
> such as this.  But I'm not sure it would support the type of 
co-constraint 
> that you require here.)

Greetings,
          What is the section in XML Schema 1.1 draft that explains this
feature? If this feature is not currently possible in XML Schema, what 
would
syntax would you suggest?

My goal here is to be able to describe binary file formats using XML 
Schema,
or any other scheman language (such as ASN.1, does ASN.1 this then?)...

Any help would be appreciated...
Carl



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Received on Saturday, 3 February 2007 21:09:00 UTC