OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   is rng compact, compact enough?

[ Lists Home | Date Index | Thread Index ]
  • To: XML Dev <xml-dev@lists.xml.org>
  • Subject: is rng compact, compact enough?
  • From: Bill de hÓra <bill@dehora.net>
  • 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

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








 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS