[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] is rng compact, compact enough?
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! 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
|