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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A non-XML syntax for RELAX NG

Another approach would be to have a mixed syntax with the content model and names using
an abbreviated syntax, but XML elements elsewhere (i.e. mixed content).  That would
still allow terseness (people can write in terms of content models), allow nice formating
with a stylesheet and ids. 
<grammar xmlns="slightlyRelaxed">
  <defaultNamespace rng = "http://relaxng.org/ns/structure/0.9"/>
  <namespace local = "" />
  <datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" />


  <rule for="pattern">
   <element name="element">(nameQName | nameClass), (common & pattern+)</element>
   | <element name="attribute>(nameQName | nameClass), (common & pattern?)</element>
   | <element name="group|interleave|choice|optional
            |zeroOrMore|oneOrMore|list|mixed">common & pattern+</element> 
   | <element name="ref|parentRef">nameNCName, common </element>
   | <element name="empty|notAllowed|text">common </element>
   | <element name="data">type, param*, (common & exceptPattern?) </element>
   | <element name="value">commonAttributes, type?, xsd:string </element>
   | <element name="externalRef">href, common </element>
   | <element name="grammar">common & grammarContent* </element>

  <rule for="param">
    <element name="param">commonAttributes, nameNCName, xsd:string</element>

  <rule for="exceptPattern">
    <element name="excep">common & pattern+ </element>

  <rule for="grammarContent">	
   | <element name="div">common & grammarContent* </element>
   | <element name="include">href, (common & includeContent*) </element>

  <rule for="includeContent">	
   | <element name="div">common & includeContent* </element>

  <rule for="definition">
   <element name="start">combine?, (common & pattern+) </element>
   | <element name="define">nameNCName, combine?, (common & pattern+) </element>

  <rule for="combine">
   <attribute name="combine">"choice" | "interleave"  </attribute>

  <rule for="nameClass">
    <element name="name">commonAttributes, xsd:QName</element>
   | <element name="anyName">common & exceptNameClass?</element>
   | <element name="nsName">common & exceptNameClass?</element>
   | <element name="choice">common & nameClass+ </element>

  <rule for="exceptNameClass">
   <element name="except">common & nameClass+</element></rule>

  <rule for="nameQName">
   <attribute name="name">xsd:QName  </attribute></rule>

  <rule for="nameNCName">
   <attribute name="name">xsd:NCName  </attribute></rule>

  <rule for="href">
   <attribute name="href">xsd:anyURI  </attribute></rule>

  <rule for="type">
   <attribute name="type">xsd:NCName  </attribute></rule>

  <rule for="common">commonAttributes, foreignElement*</rule>

  <rule for="commonAttributes">
   <attribute name="ns">xsd:anyURI</attribute>?,
   <attribute name="datatypeLibrary">xsd:anyUR</attribute>?,

  <rule for="foreignElement">
   <element name="* - rng:*">(anyAttribute | text | anyElement)* </element></rule>

  <rule for="foreignAttribute">
   <attribute name="* - (rng:*|local:*)">text </attribute></rule>

  <rule for="anyElement">
   <element name="*">(anyAttribute | text | anyElement)*</element></rule>

  <rule for="anyAttribute">
   <attribute name="*">text </attribute></rule>

Rick Jelliffe