Re: Issue: are <optional>, <oneOrMore>, <zeroOrMore> verbose?

From
Murata Makoto <>
Date
2001-07-09T07:38:41+00:00
ID
Thread
Re: Issue: are <optional>, <oneOrMore>, <zeroOrMore> verbose?
>It won't surprise you to learn that I like things as they are. Here
>are my reasons:

I did mention attributes, since they are used by XML Schema and RELAX
Core.  However, I do not think that they are nice.  It has a number of
drawbacks as you pointed out (its only advantage is that it is less 
verbose).  On the other hand, I do think that

<optional>
  <attribute name="foo">
...
  </attribute>
</optional>

is verbose, especially when this is repeated again and again (how do 
others feel?).  You put two start tags in the same line.  When the 
attribute element has a child, the result (see below) will look strange.

<optional><attribute name="foo">
...
</attribute></optional>


Here are some suggestions.

1) a new keyword  (syntax sugar)

<optionalAttribute name="foo">
...
</optionalAttribute>

which is equivalent to:

<optional>
  <attribute name="foo">
...
  </attribute>
</optional>


2) recommends a convention in the tutorial

<zeroOrMore>
  <choice>
    <attribute name="foo1">
  ...
    </attribute>
    <attribute name="foo2">
  ...
    </attribute>
    <attribute name="foo3">
  ...
    </attribute>
    <attribute name="foo3">
  ...
    </attribute>
...
</zeroOrMore>

Note: this does not work when we have both optional and 
mandatory attributes.


Cheers,

Makoto