OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Schema constraints from a different file?

[ Lists Home | Date Index | Thread Index ]

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




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS