|
[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?)
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! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||







