views:

37

answers:

1

Is there a way to refer to a group of non-nested XML tags in XSD schema, e.g.:

<foo>
  <a>a_val</a>
  <b>b_val</b>
  <c>c_val</c>
  <d>d_val</d>
</foo>
<bar>
   <e>e_val</e>
   <b>b_val2</b>
   <c>c_val2</c>
   <f>f_val</f>
</bar>

What I want to achieve is to have tags <b> and <c> extracted separately as complexType or abstract element, because the very same <b>...</b><c>...</c> sequence might appear elsewhere (as in this example, inside <bar>). Is this possible?

I have also considered defining base object, and deriving <foo> and <bar> from it. However I would prefer lighter solution if possible due to nature of the real-life data.

Thanks in advance.

+2  A: 

Not exactly sure, but are you looking for the xsd:group element?

VolkerK
That sounds right, was just on my way to look this up myself :)
Mark Dickinson
Absolutely! Thanks very much!
mindas
In that case +1 for the question. Wasn't 100% sure what you meant by "_extracted_ separately"...
VolkerK