Re: XML: How to require either or both of two child elements, but prevent both missing?
Hi all, I suppose William Ullate is right way; nevertheless, his example isn't completed and doesn't work. The correct syntax of William code is here: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Parent"> <xs:complexType> <xs:choice> <xs:group ref="elementAoptB"/> <xs:element ref="elementB" minOccurs="1"/> </xs:choice> </xs:complexType> </xs:element> <xs:group name="elementAoptB"> <xs:sequence> <xs:element name="elementA" minOccurs="1"/> <xs:element ref="elementB" minOccurs="0"/> </xs:sequence> </xs:group> <xs:element name="elementB"/> </xs:schema> This work fine. Pavel Benda Czech Collection of Microorganisms pavelben@sendme.cz
participants (1)
-
Pavel Benda