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

is rng compact, compact enough?

  • To: XML Dev <xml-dev@l...>
  • Subject: is rng compact, compact enough?
  • From: Bill de hÓra <bill@d...>
  • Date: Sat, 28 Jun 2003 13:11:25 +0100
  • User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312

element td download
Playing about with RNG compact syntax, I've come to the conclusion 
that it's to harder to read than the XML syntax.

The problems came down to:

-position of the quantifiers
-redundant keywords


For example, this from the tutorial:

   element addressBook {
     element card {
       element name { text },
       element email { text },
       element note { external "inline.rnc" }?
     }*
   }

could easily become this:

   addressBook {
     card* {
       name { text },
       email { text },
       note? { "inline.rnc" }
     }
   }

which imvho puts less effort on the reader. I found myself rewriting 
bits of the tutorial in this way. And when the schemas get 
substantial it's just too hard to figure out what the quantifier is 
bound to. Consider the + quantifier below:

element html {
   element head {
     element title { text }
   },
   element body {
     element table {
       attribute class { "addressBook" },
       element tr {
         attribute class { "card" },
         element td {
           attribute class { "name" },
           mixed {
             element span {
               attribute class { "givenName" },
               text
             }?,
             element span {
               attribute class { "familyName" },
               text
             }?
           }
         },
         element td {
           attribute class { "email" },
           text
         }
       }+
     }
   }
}

when you could have this:


element html {
   element head {
     element title { text }
   },
   element body {
     element table {
       attribute class { "addressBook" },
       element+ tr {
         attribute class { "card" },
         element td {
           attribute class { "name" },
           mixed {
             element? span {
               attribute class { "givenName" },
               text
             },
             element? span {
               attribute class { "familyName" },
               text
             }
           }
         },
         element td {
           attribute class { "email" },
           text
         }
       }
     }
   }
}

Also, attributes don't need to be bracketed; by nature they don't 
have any structure on the rhs. An enumeration can just be a comma 
delimited list:

element html {
   element head {
     element title { text }
   },
   element body {
     element table {
       attribute class:"addressBook",
       element+ tr {
         attribute class:"card",
         element td {
           attribute class:"name",
           mixed {
             element? span {
               attribute class:"givenName",
               text
             },
             element? span {
               attribute class:"familyName",
               text
             }
           }
         },
         element td {
           attribute class:"email,sms,pigeon",
           text
         }
       }
     }
   }
}

Thoughts?

Bill de hÓra





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.