Lists Home |
Date Index |
Actually, owing to the possibility of wildcards, substitutions and derived
types outside a given schema, you cannot even do the particular test
In schema for namespace A, we define element ea, which does not forbid
itself from being the head of a substitution group. In schema for namespace
B, we define element eb which declares itself to be in the substitution
group headed by A:ea (satisfying the appropriate conditions on the types of
eb and ea). Then in an instance conforming to schema A, we might find B:eb
where A:ea is declared to occur. Checking the xpath //B:eb against schema
A will not be very useful. Validating against schema B would be better, but
would be non-trivial. Given a document with a root of A:x, you're not
always going to know which of the other namespaces it declares is the right
one to validate some xpath against.
If schema A declares type ta and schema B extends this type by adding the
element foo and calling the type tb, then an instance document conforming to
a type ta can actually contain the content of tb, and hence a foo element.
Of course, the moment wildcards (types, elements or attributes) are used, an
xpath that descends into the subtree of the document replacing the wildcard
can contain anything (subject to the namespace constraints).
----- Original Message -----
From: "Sean McGrath" <firstname.lastname@example.org>
Sent: Monday, January 13, 2003 11:47 PM
Subject: [xml-dev] XPath validation against a schema rather that against an
> Heres a question I was asked today which struck me:
> >Is there any way I can validate a XPATH against a XML Schema (and not
> >against the XML document)
> I don't know of anything like this. I can see why it would be a useful
> sanity check of XPath usage in some contexts. I.e. "warning: //foo can
> match in schema XXX because there is no 'foo'".