This is a part of my xml schema
You have to limit yourself a little bit, some of the things you are trying to do are not possible in XML Schema.
Suppose you introduce a complex type called Person
to be a super-type of Friend
and Coworker
. Here are your options:
xs:all
with xs:sequence
, remove name
and phone
from the sub-types, add to the super-type, and add inheritance. Your elements now have to be ordered, but you can make them individually optional. It is illegal to use xs:all
in type hierarchies in XML Schema, because the processor cannot tell where the parent content model stops and the child content model starts.xs:all
with
in both types, and add your inheritance. Then your elements become unordered again, but they may repeat.So in conclusion: given your type names up there, I would guess that your requirements will not be exactly met. I would go for the first option: insisting on arbitrary element order is often not as useful as it seems.