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

Re: Are we losing out because of grammars?

  • From: James Clark <jjc@j...>
  • To: Norman Walsh <ndw@n...>
  • Date: Fri, 02 Feb 2001 11:18:44 +0700

james walsh xsd
Norman Walsh wrote:

> / James Clark <jjc@j...> was heard to say:
> | It's not in general easy, unless you restrict the grammar.  For example,
> | consider the following TREX pattern:
> 
> I'm confused in a couple of ways.
> 
> | <element name="x">
> |   <zeroOrMore>
> |     <element name="y">
> |       <attribute name="z">
> |         <data type="xsd:string"/>
> |       </attribute>
> |     </element>
> |   </zeroOrMore>
> |   <element name="y">
> |     <data type="xsd:integer"/>
> |   </element>
> | </element>
> |
> | If I'm in an "x" element and I get a "y" element with a "z" attribute
> | that is a legal lexical representation of an integer, I can't tell
> | whether to type that attribute as an "xsd:integer" or an "xsd:string"
> 
> There's only one z attribute in your example, did you mean for both y's
> to have z attributes with different types?

Yes, sorry.

> | unless I lookahead and see whether it's the last element "y" element in
> | the "x".   The TREX implementation works on a stream of SAX events, so
> | this is a big complication.
> 
> I'm a little confused by this example. I would have thought that the
> validator had to look ahead anyway in this case.

Actually, it doesn't.  This makes implementation a little bit more
interesting than DTD content models.

> I thought that the model was to find a matching TREX element
> definition for each element in the instance. If you don't look ahead
> to see if you've got the last y, how can you pick the matching
> definition?

It doesn't have to find a matching TREX element pattern, it merely has
to determine that there is at least one TREX element pattern that
matches; if there's more than one, it doesn't have to determine which. 
When it sees the "y" it will find that there are two ways it could have
matched; it remembers that and proceeds accordingly.  If it sees another
"y", it determines that one of those two ways is no longer a
possibility.

James


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.