Jump to content
Sign in to follow this  
Guest kalos

Define elements with same name and different structure (Type)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...