[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tricky validation problem w multiple schemas
- To: <xml-dev@lists.xml.org>
- Subject: tricky validation problem w multiple schemas
- From: "Naomi Dushay" <Naomi@cs.cornell.edu>
- Date: Mon, 19 Nov 2001 14:13:28 -0500
- Thread-index: AcFxLkU2sk1FWP4jQ4eePk6cjBIFsA==
- Thread-topic: tricky validation problem w multiple schemas
Given the following XML instance doc:
<DO xsi:noNamespaceSchemaLocation="DO.xsd">
<DS DSID="a">
<MIME>text/plain</MIME>
</DS>
<DS DSID="b">
<MIME>image/gif</MIME>
</DS>
<FRIP ID="f1" xmlns:FSch="http://fsch.ns"
xsi:schemaLocation="http://fsch.ns FRIPQ.xsd">
<desc>this is an instance of a Q frip</desc>
<FSch:roleq1 RDSID="a" />
<FSch:roleq2 RDSID="b" />
</FRIP>
<FRIP ID="f2" xmlns:FSch="http://fsch.ns"
xsi:schemaLocation="http://fsch.ns FRIPZ.xsd">
<desc>this is an instance of a Z frip</desc>
<FSch:rolez RDSID="a" />
</FRIP>
</DO>
I want to validate all non-namespace qualified tags against DO.xsd, and
all the FSch qualified tags against FRIPQ.xsd. Frips are extensible
content that plug into a DO. The DO *SCHEMA* doesn't know about
specific FRIPs. The instance doc needs to make it obvious which parts
come from which specific frips: frip role tags must be namespace
qualified.
Specific frips are supposed to be reusable, extensible pieces for
different instance docs.
I can write DO.xsd so the above instance doc validates to DO.xsd (by
using an "any" element in the right place in the schema).
I can't figure out how to write FRIPQ.xsd so the above validates to
FRIPQ.xsd. I figured that the problem was that there's no single root
node for a FRIP in FRIPQ.xsd -- that XML schemas won't handle the above
the way I want. So I changed my XML instance doc to the following:
instance doc 2:
<DO xsi:noNamespaceSchemaLocation="DO.xsd">
<DS DSID="a">
<MIME>text/plain</MIME>
</DS>
<DS DSID="b">
<MIME>image/gif</MIME>
</DS>
<FRIP FID="f1">
<desc>this is an instance of a Q frip</desc>
<FSch:root xmlns:FSch="http://fsch.ns"
xsi:schemaLocation="http://fsch.ns FRIPQ.xsd">
<FSch:roleq1 RDSID="a" />
<FSch:roleq2 RDSID="b" />
</FSch:root>
</FRIP>
</DO>
I can validate instance doc 2 against DO.xsd.
If I snip out the FSch qualified XML, I can validate that against
FRIPQ.xsd.
But I'm still not happy:
1. Neither XML Spy nor Topologi has a way for me to validate the
appropriate piece of XML instance doc 2 against FRIPQ "in situ." That
is, the only way I've found to validate against FRIPQ.xsd is to snip out
that piece of XML and make it a separate instance doc.
2. RDSID within a frip role tag is supposed to be an IDREF to a
DSID attribute in a DS tag.
But in the above model, my frip schema doesn't know about DO.xsd
... so how can they refer to XML in the DO?
And I don't believe I can do this with Schematron, either, for
the same reason ... I want the specific schematron rules to be included
via <appinfo> in the FRIP schema, but it somehow needs to reference
elements that are parents and siblings to the frip root element.
Is there a way for me to do all of these:
a. have DO schema that will allow extensible frips to be
plugged in at the appropriate spot.
b. DO schema doesn't know anything about specific frip schemas,
only DO instance docs know about specific frip schemas.
c. specific frip validating doc can be used to validate
specific frip instance in DO instance doc.
d. specific frip validating doc can validate:
i. correct role elements for specific frip
ii. attribute RDSID for each role is an IDREF
refering to a DSID in a DS element in DO instance doc.
iii. match RDSID for each role to DSID pertaining to
correct MIME type specified (e.g. for Frip Q, roleq1 must match DS with
MIME "text/plain")
I know that d.ii and d.iii could be done with Schematron IF the
schematron schema is written to pertain to the whole document.
BUT it's my dream for d.ii and d.iii to be in the specific frip
validating doc ...
any suggestions out there?
- Naomi
Naomi Dushay
Cornell Digital Library Research Group
Department of Computer Science
Cornell University
4130 Upson Hall
Ithaca, NY 14853-7501 USA
naomi@cs.cornell.edu
607-255-2528 (voice)