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

From
James Clark <>
Date
2001-07-09T11:05:56+00:00
ID
017501c10866$df5e2520$
Thread
Re: Issue: are <optional>, <oneOrMore>, <zeroOrMore> 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?).

So your measure of verbosity is "number of lines when traditionally
indented"?

> Here are some suggestions.
>
> 1) a new keyword  (syntax sugar)
>
> <optionalAttribute name="foo">
> ...
> </optionalAttribute>
>
> which is equivalent to:
>
> <optional>
>   <attribute name="foo">
> ...
>   </attribute>
> </optional>

I could live with this, if others thing we have a verbosity problem here.

> 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>

This seems a little bit too tricky for my taste.

I also wouldn't mind an attribute on <attribute> indicating optionality, eg

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

<optional> is sugar anyway.  The thing I really don't want to do is use
attributes for <oneOrMore> or <zeroOrMore>.

James