[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Type-assignment (was Re: Are we losing out because of grammars?)

  • From: Murata Makoto <mura034@a...>
  • To: James Clark <jjc@j...>
  • Date: Fri, 02 Feb 2001 15:05:59 +0900

integer empty xml type
James Clark wrote:

> I think closure is not just of theoretical importance.  This is one
> reason why I want to keep type-assignment and validation separate: it's
> useful to have the validation be closed under
> union/intersection/difference, even if type-assignment isn't.  

Nice to hear that.  We are in the same camp.

>I think I
> can live with fairly trivial type-assignment (as in W3C's XML Schemas),
> which allows type assignment to be done in a single, streaming pass, but
> I want to have more sophisticated validation (which can also be done in
> a single, streaming pass).

But XML Schema is not closed under union or difference. Consider two modules 
written in RELAX Core as below:

 module 1

<module ...>
  <interface><ref label="doc"/></interface>
  <elementRule role="doc">
    <sequence>
      <ref label="foo1"/>
      <ref label="bar1"/>
    </sequence>
  </elementRule>
  <elementRule role="foo" label="foo1">
    <empty/>
  </elementRule>
  <elementRule role="bar" label="bar1" type="integer"/>
    <empty/>
  </elementRule>
  <tag name="foo"/>
  <tag name="bar"/>
</module>

module 2

<module ...>
  <interface><ref label="doc"/></interface>

  <elementRule role="doc">
    <sequence>
      <ref label="foo2"/>
      <ref label="bar2"/>
    </sequence>
  </elementRule>
  <tag name="foo"/>
  <elementRule role="foo" label="foo2">
    <ref label="hoge"/>
  </elementRule>
  <elementRule role="bar" label="bar2" type="integer"/>
    <ref label="hoge"/>
  </elementRule>
  <tag name="foo"/>
  <tag name="bar"/>
  <elementRule role="hoge" type="string"/>
  <tag name="hoge"/>
</module>

Its union is:

<module ...>
  <interface><ref label="doc"/></interface>
  <elementRule role="doc">
  <choice>
    <sequence>
      <ref label="foo1"/>
      <ref label="bar1"/>
    </sequence>
    <sequence>
      <ref label="foo2"/>
      <ref label="bar2"/>
    </sequence>
  </choice>
  </elementRule>

  <elementRule role="foo" label="foo1">
    <empty/>
  </elementRule>

  <elementRule role="bar" label="bar1">
    <empty/>
  </elementRule>

  <elementRule role="foo" label="foo2">
    <ref label="hoge"/>
  </elementRule>

  <elementRule role="bar" label="bar2">
    <ref label="hoge"/>
  </elementRule>

  <elementRule role="hoge" type="string"/>

  <tag name="foo"/>
  <tag name="bar"/>
  <tag name="hoge"/>

</module>

This cannot be captured by XML Schema, because of the single-type 
constraint.

RELAX Core does not impose special restrictions (except some 
restrictions on ID/IDREF/IDREFS), but conformance section of RELAX Core 
allows implementations to give up when "semi-deterministic top-down 
with one lookahead" is not possible (e.g., the union example shown above).

Cheers,

Makoto

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.