- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Thu, 6 Feb 2003 15:16:58 +0000
- To: Robin Berjon <robin.berjon@expway.fr>
- CC: xmlschema-dev@w3.org
Hi Robin,
> That's not the point. I want to /not/ have a schema for the
> enclosing XML. I just want one for my vocabulary, irrespective of
> what it's embedded in, and I want to be able to use that schema
> whether or not a schema exists for the enclosing XML.
If you assert that the document element in the documents that you're
validating are of the type xsi:anyType then you should get lax
validation down the tree, such that you only validate the elements
that you've declared. So you can do something like:
<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.example.com
fragment.xsd"
xsi:type="xs:anyType">
...
<fragment xmlns="http://www.example.com">
...
</fragment>
...
</foo>
and the <fragment> element will be validated against the declaration
in fragment.xsd (although actually it won't get validated if it
doesn't have a global element declaration -- there's no way to enforce
strict validation from that point down).
That's the only method I can think of using XML Schema. Of course
using RELAX NG it would be straightforward...
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 6 February 2003 10:17:48 UTC