I\'m trying to write an XSD against some XML that looks (structurally wise) something like this:
foo<
At the design level, the question to ask is why you wish to specify two different elements with different validity conditions, and then use their element type names to say that they are the same thing. Do you believe that lying to the processor in this way is good design?
At the schema level: the type to be assigned to an element is completely determined by the path from the validation root. (If the validation starts at the document root, then in your example the type of a response
element must be completely determined by the path /responses/response
. It is perfectly legal to have two elements with the same name which appear in different contexts (where 'context' is defined solely by ancestry and not by siblings); it is not allowed in XSD to have different default types for two siblings of the same name.