[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
RELAX NG require oneOrMore optional elements
- From: Frank Cusack <fcusack@redhat.com>
- To: xml-dev@lists.xml.org
- Date: Tue, 15 Jul 2008 12:39:55 -0700
Is it possible to require one or more from a list of optional elements?
If I have something like:
<element name="parent">
<oneOrMore>
<interleave>
<optional>
<element name="child1">
<text/>
</element>
</optional>
<optional>
<element name="child2">
<text/>
</element>
</optional>
</interleave>
</oneOrMore>
</element>
My intent is that <parent> must have at least 1 of the child elements.
But python-lxml (which I guess is libxml2) doesn't flag
<parent />
as erroneous. Note that my actual list of child elements is quite long.
I also tried <oneOrMore><choice>...</choice></oneOrMore> and removing
all the <optional> wrappers. This does require that at least one child
be present but doesn't prevent repetition of child elements. I thought
about adding xsd:maxOccurrence attributes to each child element but
I'm not sure how to get the RelaxNG parser to understand them.
-frank
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]