I have an XML which I validate by an XSD schema. inside the XML, I have the element . depending on value of stereotype attribute, I want to have different inner structure for the element; take following two variations:
1)
<step stereotype="checkerStep" taskType="tableChecker">
<tableName>employee</tableName>
</step>
2)
<step stereotype="branchStep">
<branchName>whichStep</branchName>
</step>
as you can see, if stereotype is "checkerStep", as taskType attribute would be necessary, and a tableName inner element is expected. on the other hand, if stereotype is "branchStep", no attribute should be included and a branchName inner element is expected.
I googled my problem and found some answer which suggests using choice indicator, however as it's admitted in the comments under the answer , it's doesn't really address the question; because choice indicator doesn't allow elements with the same name in the same scope!
then, what do I do?