Jump to content

Define elements with same name and different structure (Type)


Guest kalos
 Share

Recommended Posts

Guest kalos

Hi all,I know the "Consistent element's definition" rule in xml W3C schema-language, and so I experiment the difficulties of defining an element that contains two other elements with same name but different types. A thing like

<A>  <B x="...">	...  </B>  <B y="...">   ...  </B></A>

With first end second B having different attributes end/or childs. Of course I can define it using che "choice" or "substitution-groups" language-constructs, but what if I have to fix some constraints about each of B's, like some order, occurrence or attribute values and types? Could I anyway define, really differents B's type, an then use o reference that definitions? Thank you all in advance for any suggestion.Kalos

Link to comment
Share on other sites

I guess it could be possible if you make sure to use local declarations (no ref) for at least one of the B element, and you make sure that the two elements with the same name are declared in a precise order in your xml schema declaration so that your .xsd know which <B..> he's refering to.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...