XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RELAX NG require oneOrMore optional elements

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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS