Altova Mailing List Archives>Archive Index >xml-dev Archive Home >Recent entries >Thread Prev - >Thread Next - Re: [xml-dev] RELAX NG require oneOrMore optional elements RELAX NG require oneOrMore optional elementsTo: xml-dev@-----.---.--- Date: 7/15/2008 7:40:00 PM 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
