Subject:XSD – external xml lookup ?? Author:Richard Potts Date:31 Jul 2007 08:16 AM Originally Posted: 31 Jul 2007 08:15 AM
Couldn't find a XSD forum so posted it here. Hope that's ok.
I have an XML document
With a structure similar to:
<Module Acronym="AAM" Supplier="Fred" Lamp="N">
<Models>
<Model>K150</Model>
</Models>
</Module>
<Module Acronym="ABN" Supplier="Jim" Lamp="N">
<Models>
<Model>K319</Model>
<Model>J320</Model>
<Model>H322</Model>
</Models>
</Module>
<Module Acronym="BNC" Supplier="Jim" Lamp="N">
<Models>
<Model>K319</Model>
<Model>H322</Model>
</Models>
</Module>
And I want to write an XSD to check this file. In particular I want to check the Acronym attribute is correct. From my limited XSD knowledge (2 days worth!) I know I can do this using a list of enumerated types e.g.
So I was wondering if there is a mechanism in XSD to do an external document 'lookup'. This would make it much more powerful if there was. Anyone know if this is possible or do I have to manually create the xsd 'enumerated list' and then manually update it whenever the master xml changes?
Subject:XSD – external xml lookup ?? Author:Tony Lavinio Date:31 Jul 2007 10:12 AM
Sorry, XSD has no external lookup mechanism.
You could generate an XSLT transform to take the list from the XML
file and write an XSD containing the enumerated list, and then you
could run that XSLT whenever the XML changes to create a new XSD.
You could even generate wrap it as a web service, and refer to it
using http://, so that it would be generated 'on-demand' from the
original XML whenever you did validation.