Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Key, KeyRef in different XSD documents

Tags:

xml

xsd

Is this possible?

Say for example I have

customers.xml

<customers>
    <customer>1</customer>
    <customer>2</customer>
</customers>

orders.xml

<orders>
    <order>
        <customer>1</customer>
    </order>
    <order>
        <customer>3</customer> Invalid as Customer 3 doesn't exist
    </order>
</orders>

How would the XSD (using key and keyref) look for this (customer.xsd and orders.xsd would also be two different files with different namespaces), is it even possible. All the examples I have seen deal with single files.

Can Keys and Keyrefs be spread across multiple XSD files?

like image 621
anonymouse Avatar asked Apr 16 '26 10:04

anonymouse


1 Answers

It's not possible. No XML schema construct or constraint works across multiple files.

like image 130
xcut Avatar answered Apr 18 '26 08:04

xcut