Recently I got a question from a coworker of mine if it was possible to do extended validation on XML documents. I proposed to use XML schema's for just that since that just works. He went away with that but got back to me a few weeks later that he was quite happy with the options to express loads of data-qualifications with simple- and complex-attributes but the thing he still ran into was linking. I said that the common way to express link requirements in XSD is by applying Xlink. That somehow was satisfactory for him but it only took a little while for him when he got back that it indeed fulfilled some of his issues but not exactly.
The thing he ran into was, taken from a data quality viewpoint was that there was no way to check the actual existence of the inputted ID. Lets propose the following XML:
<S123:RadioStation xml:id="JS.RDOSTA.01">
<featureName><name>JUSSLAND MRCC</name></featureName>
</S123:RadioStation>
Now there's another XML element referencing this XML element, lets say the following:
<S123:RadioServiceArea xml:id="JS.RDOSVC.01">
<featureName><name>JUSSLAND MRCC service area></name></featureName>
<serviceProvider xlink:href="#JS.RDOSTA.01" xlink:role="http://www.iho.int/S-123/gml/1.0/roles/serviceProvider" xlink:title="serviceProviderArea"/>
</S123:RadioServiceArea>
Now I could come up with an XSD that perfectly validates both objects and the existence of the serviceProvider XML-element but for the life of me I can't come up with something that instructs the schema validator to check on the actual existence of the specified link (#JS.RDOSTA.01). I could not find anything in the XML Schema specifications nor in the Xlink specifications. Is there's something I'm missing or overlooking or is it just that I want too much and it's just not possible to instruct any schema validator to do just this?
I think XSD 1.1's Assertions are the solution to this issue. I found out that it's possible to create an Assertion that if the link is internal it goes to check on the existence of the link. The downside though of Assertions is that it is XSD 1.1 and Microsoft as far as I know still doesn't support 1.1.