We have a situation where we want to restrict an element to having:
- Either text(). or
- Subelements.
E.g.
<a>mytext</a>
or
<a><b>xxx</b></a>
But not:
<a>mytext<b>xxx</b></a>
Given the xs:simpleContent mechanism I can restrict it to having only text, and of course I can define the element(s) it can be allowed, but does anyone know how I can combine the two to allow either text or subelements but not both?
Ta
Jamie
Another option is for you to use inheritance. Your resulting XML isn’t as pretty, but you get exactly the content you want:
Then your resulting XML would contain the following (assuming you have
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"declared somewhere)or
Most importantly, it disallows