to make xsd for element with same names that only identifyed by attribute value example :-
<a>
<b n="structure one">
<c n="inner element 1"/>
<c n="inner element 2"/>
<c n="inner element 3"/>
</b>
<b n="structure two">
<c n="inner element 1 for structure two"/>
<c n="inner element 2 for structure two"/>
<c n="inner element 3 for structure two"/>
</b>
</a>
notice that from the XML i have to mention specific value that belong to the inner element same for structure
Not sure what your specific requirements are, but the following schema validates your document. It says that the root element must be named
a, and it can contain any number ofbelements, which themselves contain any number ofcelements. Thebandcelements must contain the attribute with the namen.If you want to constrain the attributes to a specific set of values, you can use a restriction. This schema enumerates the possible values of the
nattributes on thebandcelements:You can also constrain the values of the attributes with a regex pattern, like this: