OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: Re: [relax-ng] Motivation for restrictions in section 7.2

On Fri, 2002-07-05 at 11:21, Murata Makoto wrote:
> >Can someone explain me (or give some pointers) the reasons for the
> >restrictions in section 7.2 which introduce a difference between content
> >models which doesn't seem needed a priori.
> Without this, validation becomes extremely difficult.  

If we follow the XPath (1.0) data model and consider that each "data" or
"value" pattern matches a single text node I don't think that this is
that difficult...
> How do you validate "33333000" against 
> <group>
>   <data type="xsd:short"/>
>   <data type="xsd:short">
>     <param name="maxInclusive">10000</param>
>   </data>
> </group>?
> We have to break "33333000" into two strings, namely  
> "3333" and "3000".  

No, not if you think in term of "text nodes" instead of strings. In this
case you have a single text node and a group requiring 3 text nodes.
It's thus clear that the document is invalid!

> This requires backtracking.  
> (And this document is useless for application programs 
> unless they can receive "3333" and "3000".) 
> Moreover, how do we handle whitespace?  Suppose we 
> have 
> <element name="foo">
>   <group><data type="xsd:short"/>
>          <element name="a"><empty/></element>
>    </group>
> </element>
> and 
> <foo>
>   1
>   <a/>
> </foo>
> People would expect that this is valid.  Then, suppose 
> <element name="foo">
>   <group><data type="xsd:string">
>            <param name="minLength">2</param>
>          </data>
>          <element name="a"><empty/></element>
>    </group>
> </element>
> as a pattern.  Does the previous element match with the 
> pattern?

No, clearly not. You have a "foo" element with a text node equal
to:"\n\t1\n\t", you've explicitely require to keep whitespaces by
chosing a "xsd:string" type thus the length of the value is 5 and the
constraint of the facet is not met.

> I feel that <list> causes even more difficult problems.

I don't think so either: I understand the "list" pattern as a
transformation of a text node into a list of text nodes split on their
whitespaces. There is no confusion at this level IMO.

Sorry to insist, but I must be missing something obvious!

The specs says explicitely:

An XML document is represented by an element. An element consists of

    * a name
    * a context
    * a set of attributes
    * an ordered sequence of zero or more children; each child is either
an element or a non-empty string; the sequence never contains two
consecutive strings

This IMO, clearly identifies "strings" as what XPath calls text nodes.

and later on:

RELAX NG relies on datatype libraries to perform datatyping. A datatype
library is identified by a URI. A datatype within a datatype library is
identified by an NCName. A datatype library provides two services.

    * It can determine whether a string is a legal representation of a
datatype. This service accepts a list of zero or more parameters. For
example, a string datatype might have a parameter specifying the length
of a string. The datatype library determines what parameters are
applicable for each datatype.
* It can determine whether two strings represent the same value of a
datatype. This service does not have any parameters.

If these are the same "strings", there can be no doubt that they match
actual text nodes in the document, with the exception of list types
which "returns a sequence of strings one for each whitespace delimited
token of s; each string in the returned sequence will be non-empty and
will not contain any whitespace".

I don't see where there is any confusion in the interpretation of the
examples you gave if we stick to these definitions.


See you in San Diego.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC