1

My goal is to have an element that can contain any number of shape elements (circle, rectangle, triangle). I am completely new to XML and XSD and am having trouble figuring out how to do this.

Basically I want it to validate the following

<array>
    <circle/>
    <circle/>
    <triangle/>
    <circle/>
</array>

I would also like the array to contain further arrays. Can you express this in XSD in some way? So I can validate something like this

<array>
    <circle/>
    <circle/>
    <array>
        <rectangle/>
    </array>
    <triangle/>
    <circle/>
</array>

So to sum up:

  • Can I make an element type shape and then have the different types as sub-types?

  • Can I do array elements recursively?

user3207230
  • 587
  • 7
  • 16
  • Here is a [related similar question](https://stackoverflow.com/questions/148988/recursion-in-an-xml-schema) for info about the recursive part. – sergioFC Feb 08 '18 at 22:24

0 Answers0