 |
 |
 |
Is there a way in XML schema to validate elements A, B, AB, BA, but not
permit duplicates like AA, BB, ABA, etc, and here's the hard part, not
validate unless at least one of A or B exists?
It's like saying, "I want one or the other or both, but not more than
one of either, and order doesn't matter to me."
This is how far I got after much testing, but it unfortunately
validates when there are *neither* A nor B elements present:
<xs:complexType name="Name">
<xs:all>
<xs:element name="A" type="xs:string" minOccurs="0"/>
<xs:element name="B" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
Here's my test cases that should validate (each line is a separate
document):
good: <A/>
good: <B/>
good: <A/><B/>
good: <B/><A/>
Here's my test cases where it should *not* validate:
good: <A/><A/>
good: <B/><B/>
bad: <!-- empty -->
Everything works except the very last test case. I want it to fail
validation when nothing is present, but it still validates just fine.
Ugh. Any advice?
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |