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: Issue: duplicate attributes (duplicateAttributes)



> I am totally confused.  If more than one <attribute ...> element
> within a single content model is satsified by an attribute, are ALL of
> them consumed?  Or, is only ONE of them consumed?

One, just as with elements.

> As an example, consider:
>
> <define name="common.atts">
>   <optional>
>     <attribute name="id">
>       <data type="xsd:ID"/>
>     </attribute>
>     <attribute name="bar">
>       <data type="xsd:short"/>
>     </attribute>
>   </optional>
> </define>

That's an untypical model.  Usually, you would have each attribute optional
independently.  Your model requires both or neither bar and id.  Typically
you would have

<define name="common.atts">
  <optional>
    <attribute name="id">
      <data type="xsd:ID"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="bar">
      <data type="xsd:short"/>
    </attribute>
  </optional>
</define>

> Here I assume that you consume ALL attribute elements that
> match id="f".

That's not correct.  Is this not clear from the formal semantics?

> I might be wrong.  If you consume ONE <attribute ....> element,
> you first obtain
>
> <group>
>   <optional>
>     <attribute name="id">
>       <data type="xsd:ID"/>
>     </attribute>
>     <attribute name="bar">
>       <data type="xsd:short"/>
>     </attribute>
>   </optional>
>   <attribute name="bar">
>     <data type="xsd:boolean"/>
>   </attribute>
> </group>

Before you consume anything you would have:

<group>
  <optional>
    <attribute name="id">
      <data type="xsd:ID"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="bar">
      <data type="xsd:short"/>
    </attribute>
  </optional>
  <attribute name="id">
    <data type="xsd:boolean"/>
  </attribute>
  <attribute name="bar">
    <data type="xsd:boolean"/>
  </attribute>
</group>

With an "id" attribute you have two choices: you can consume the optional
"id" attribute or the required "id" attribute.  Consuming the optional "id"
attribute won't yield a match for the complete element because the required
"id" attribute will remain unmatched.  However, consuming the required "id"
attribute will.

James




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


Powered by eList eXpress LLC