[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: Norman Walsh <ndw@n...>
  • To: xml-dev@l...
  • Date: Thu, 01 Feb 2001 16:06:27 -0500

Re: Are we losing out  because of grammars?
/ 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?

| 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.

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?

If you'd said

<element name="x">
  <zeroOrMore>
    <choice>
      <element name="y">
        <attribute name="z">
          <data type="xsd:string"/>
        </attribute>
      </element>
      <element name="y">
        <attribute name="z">
          <data type="xsd:integer"/>
        </attribute>
      </element>
    <choice>
  </zeroOrMore>
</element>

I think I'd have been less confused :-)

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@E...    | If you run after wit you will succeed in
Technology Development Group | catching folly.--Montesquieu
Sun Microsystems, Inc.       | 

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.