Worker
Worker

Reputation: 2409

How to write xsd for the following xml?

I have the following XML:

<xml>
    <columns>
        <column fruit="apple" />
        <column fruit="peach" />
    </columns>
    <items>
        <item date="10.10.2009">
            <apple price="3" />
            <peach price="5" />
        </item>
        <item date="10.10.2010">
            <apple price="4" />
            <peach price="2" />
        </item>
    </items>
</xml>

Inside xml.columns.item tag can be tags with the same name as defined in xml.columns..@fruit attribute and in the same order. All tags inside xml.columns.item are always have the same attribute xml.columns.item..@price.

Does anybody know how to define this in XSD?

Upvotes: 1

Views: 789

Answers (1)

Aravind Yarram
Aravind Yarram

Reputation: 80166

You can't represent this in XSD. If you are looking to cross reference data then you should look at using ID/IDREF types. Chek ID/IDREF: sample solution

Upvotes: 1

Related Questions