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

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Re: QNames


Murata Makoto wrote:
> 
> MURATA Makoto wrote:
> 
> > Here are three other possibilities.
> 
> Let me suggest yet another.
> 
> <element xmlns:e="http://www.example.com">
>   <name><e:addressBook/></name>
>   <zeroOrMore>
>     <element><name><e:card/></name>
>       <attribute><name><e:name/></name></attribute>
>       <attribute><name><e:email></name></attribute>
>     </element>
>   </zeroOrMore>
> </element>

I couldn't live with this one.

> I have to admit I like none of my alternatives.

Of your alternatives the one I dislike the least is the first (which is
really no different from the second as far as the RELAX NG spec is
concerned).  Although it is inconvenient in some circumstances, it does
at least have the compensating advantage of simplicity both for the
specification and implementation.

Here's some more alternatives:

A)
<element name="e:addressBook" xmlns:rngns="http://relaxng.org/ns/xmlns"
rngns:e="http://www.example.com">
  <zeroOrMore>
    <element name="e:card">
      <attribute name="e:name"/>
      <attribute name="e:email"/>
    </element>
  </zeroOrMore>
</element>


B)
<element name="addressBook" nsRef="e"
        xmlns:rngns="http://relaxng.org/ns/xmlns"        
rngns:e="http://www.example.com">
  <zeroOrMore>
    <element name="card" nsRef="e">
      <attribute name="name" nsRef="e"/>
      <attribute name="email" nsRef="e"/>
    </element>
  </zeroOrMore>
</element>


C)
<namespaces e="http://www.example.com">
  <element name="addressBook" nsRef="e">
    <zeroOrMore>
      <element name="card" nsRef="e">
        <attribute name="name" nsRef="e"/>
        <attribute name="email" nsRef="e"/>
      </element>
    </zeroOrMore>
  </element>
</namespaces>

D)
<namespaces e="http://www.example.com">
  <element name="e:addressBook">
    <zeroOrMore>
      <element name="e:card">
        <attribute name="e:name"/>
        <attribute name="e:email"/>
      </element>
    </zeroOrMore>
  </element>
</namespaces>

E)
Like you example 1, ie as now but name attributes are not allowed to be
qualified, but allow <grammar> elements to group definitions using <div>
elements as in RELAX NG.  The div elements don't change the semantics of
the enclosed definitions, but, as well as being useful for annotations
and structuring large grammars, they can have common attributes
including "namespace".  Then for a mixed namespace grammar you could use
the following technique:

<grammar>

<div namespace="http://www.example.com/ns1">

<define name="Foo">
   <element name="foo">
      <ref name="Bar"/>
   </element>
</define>

<!-- other definitions of elements in the same namespace -->

</div>

<div namespace="http://www.example.com/ns2">

<define name="Bar">
  <element name="bar">
    <zeroOrMore>
      <ref name="Foo"/>
    </zeroOrMore>
  </element>
</define>

<!-- other definitions of elements in the same namespace -->

</div>

</grammar>

You could use a similar technique for mixing datatype namespaces.

Of these, I prefer E, although I still much prefer QNames...

James


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC