[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Schema constraints from a different file?


include external file
Dmitry Epstein said:
..
> Basically, I would like to develop schemas that impose
> constraints on an element or attribute in one XML file based on
> element or attribute values from another XML file.  Is this at
> all possible?  I would consider making a file containing just a
> list of all available item IDs, if that would help solve the
> problem.

XML Schemas are defined over single files. Therefore you have four basic
options

1) Use some other schema language which allows inter-document constraints.
Subchoices:
  1a) Use Schematron
  1b) Use Schematron embedded in your XML schema
  1c) Use hand-written XSLT or Java or some other programming language.
  1d) Store both data and list in the same XML database then have an
integrity constraint (e.g. written using XQuery) for this

2) Make a new larger document out of all the different data documents, and
validate that.  Subchoices
  2a) Make sure the real documents have no DOCTPE declaration, then make
your new head document have just
  <!DOCTYPE  dummy [
    <!ENTITY idlist SYSTEM "URL of IDs">
    <!ENTITY data  SYSTEM "URL of data">
  ]><dummy>&idlist;&data;</dummy>
  2b) Similar effect, except use XInclude
  2c) Similar effect, except use XSLT, m4, cpp or some transformation
preprocessor

3) Make a larger schema incorporating the IDs.  Subchoices:
  2b) Use xsd:include and an external file with the schema
  3b) Use xsd:include and put external file at a URL. Maintain the list in
your preferred format but have the webserver send it through an XSLT
transformer first.

In general, the more "tricky" constraints (where "tricky" is defined as
the repetitive and voluminous class of constraints XML Schemas is hopeless
at) you have, the more you will want to use 1).

Cheers
Rick Jelliffe

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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