XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Richard PottsSubject: 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.

<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=" AAM "></xs:enumeration>
<xs:enumeration value=" ABN "></xs:enumeration>
<xs:enumeration value=" BNC "></xs:enumeration>
</xs:restriction>
</xs:simpleType>

However I happen to already have another XML with the 'master list' of all acronyms (in another field called SHORTNAME e.g.

<ECU OBSOLETE="no">
<NAME>Another Bad Node</NAME>
<SHORTNAME>ABN</SHORTNAME>
</ECU>
<ECU OBSOLETE="no">
<NAME></NAME>
<SHORTNAME>YTR</SHORTNAME>
</ECU>

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?


Thanks in advance.

Postnext
Tony LavinioSubject: 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.

Posttop
Richard PottsSubject: XSD – external xml lookup ??
Author: Richard Potts
Date: 31 Jul 2007 10:25 AM
:-(

Thanks for the ideas Tony.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.