Re: XPath validation against a schema rather that against an
"Jeff Greif" <jgreif@a...> writes: > Actually, owing to the possibility of wildcards, substitutions and derived > types outside a given schema, you cannot even do the particular test > mentioned below. > > 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). All true, but these observations don't render the question vacuous. First of all, it often makes sense to answer the question wrt a _schema_ (not a schema _document_), i.e. making a closed-world assumption. This means that the substitution group and derived type problems go away (or rather, become part of the large-but-solvable problem), and the wildcard problem is significantly constrained. That all adds up to a broad class of cases where you can say definitively 'yes' or 'no', and so the answer 'maybe' for the residuum is also useful, because you can say "maybe, but only if the (sub-)path x/y/z occurs within the following lax-or-skip-wildcard-allowed contexts. . .". ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2002, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@c... URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam]
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format