W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2004

Re: How to reference a value in the xml instance document from schema?

From: <noah_mendelsohn@us.ibm.com>
Date: Tue, 16 Nov 2004 16:40:34 -0500
To: Daniel Einspanjer <deinspanjer@gmail.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OF50393EF2.E447BF3D-ON85256F4E.00770943@lotus.com>

These are an example of so-called co-occurrence constraints.  Schema 1.0 
has very limited support for these and cannot in any obvious way handle 
your use case.  We are looking at enhancements for Schema 1.1.  I should 
note that your example, simple as it is, rates as one of the more 
aggressive, as you are doing comparisons of >values< in the document; many 
other use cases involve primarily occurrence constraints such as "either 
this attribute or that element, but not both, may appear".   We're 
considering a variety of mechanisms and options.  No guarantee that 
anything will happen, but we are working on it.  This is a very common 
request.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








Daniel Einspanjer <deinspanjer@gmail.com>
Sent by: xmlschema-dev-request@w3.org
11/16/04 02:03 PM
Please respond to Daniel Einspanjer

 
        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        How to reference a value in the xml instance document from schema?



Hi folks, I hope that this question makes sense and that it isn't
trivial. I've searched the web and this list's archive before asking
it but I cannot find any leads. :/

In XML Schema, is it possible to refer to a value in the XML document
for purposes of schema validation?  I know that you could use an
appdata node to call out to some other type of schema validator such
as schematron, but I'm hoping this is possible in pure XML Schema.

An example might be easiest.

good xml doc
<person birthYear="1973" deathYear="2004"/>

bad xml doc
<person birthYear="2004" deathYear="1999"/>

can I write a minInclusive restriction in an XML Schema such that the
schema validates that deathYear is greater than or equal to birthYear?

Thanks for your time,

Daniel Einspanjer
Received on Tuesday, 16 November 2004 21:42:14 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:40:23 UTC