Re: Why are element and type needed both?

I share Stefan's lack of understanding of the need for types and
elements both. I also have other some other deep deficiencies in my
understanding.
I think it is nice to be able to use attribute-syntax for text-only
elements, but otherwise I don't understand the point of attributes.
Also I have some trouble understanding the need to specify sequencies.

This lack of understanding is maybe shown in the sketch below

<element name="element">
  <element name="name" datatype="attribute"/>
   <comment>Attributes are here treated just as elements, only allowing
the 
    shorter syntax (but not requiring it) </comment>
  <group comment="order=choice min=0 max=1 is defined as default below">
    <element name="datatype" datatype="attribute"/> 
    <element name="ref" datatype="attribute"/> 
  </group>
  <element name="value" datatype="attribute" maxoccur="*"/>
  <element name="default" datatype="attribute"/>
  <group ref="contentmodel"/>
  <comment>having both ref and content means the content restricts the
referred 
   element - extension can maybe handled by using groups
cleverly</comment> 
  <element name="token" datatype="attribute/variablename">
      <comment>to allow variable names to be bound to values to do some
logic 
       programming.. ignore for now"</comment>
</element>

<element name="group">
  <element name="name" type="attribute"/>
  <element name="ref" type="attribute"/> 
  <comment>if ref is given, name is usually useless
    .. but doesn't hurt any. And at top level, ref could maybe give a
group 
   that is extended by this group "</comment>
  <group ref="contentmodel"/>
</element>
 

<group name="contentmodel">
   <element name=order datatype="attribute/enum"
     value="seq" value="choice" value="repeat" default="choice"
     comment="oh dear, you are not supposed to use attributes like
that.. but it feels so goood"/> 
   <element name="maxoccur" datatype="attribute" default="1"/>
   <element name="minoccur" datatype="attribute/posint" default="0"/>
   <group maxoccur="*">
    <element name="comment" datatype=attribute comment=""/>
     <element ref="element" />
     <element ref="group"/>
   </group>
</group>

 -Timo

Received on Sunday, 6 February 2000 04:51:47 UTC