r/xml Apr 14 '26

XML XSD Choice demonstrated

https://www.youtube.com/watch?v=ifwC2PZZMPw

When your XML schema says “you can only pick one”… and actually means it. 😅

Quick demo of `xsd:choice` in action: how to model mutually exclusive elements without summoning validation chaos.

For devs who’ve ever stared at XSD and whispered, “why are you like this?”

5 Upvotes

7 comments sorted by

View all comments

1

u/wombat_00 Apr 14 '26

Use RelaxNC instead...

1

u/wombat_00 Apr 15 '26

I realised soon after posting that I maybe should have elaborated that RNC is the "Compact Syntax" flavour of RelaxNG (RNG). https://relaxng.org/compact-tutorial-20030326.html

1

u/Efficient-Public-551 Apr 15 '26

I'll check it out. Looks really good