W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2001

Re: Can schemas validate parts of an instance document?

From: Eddie Robertsson <eddie@allette.com.au>
Date: Thu, 08 Feb 2001 15:26:13 +1100
Message-ID: <3A821FE4.66079AB5@allette.com.au>
To: tom.gaven@xmls.com
CC: xmlschema-dev@w3.org
Tom Gaven wrote:

> Can schemas be used to validate 'pieces' of an instance document?  For
> example, if I have the following instance document, which reference the 2
> schemas below, should I expect a schema validator  to validate (elements a
> and r), but leave mo, larry and curly alone?

Yes, I believe that a schema validator will validate what it can. In your
example the elements <a> and <r> will be validated since a schema validator
can find a schema for these elements. The other elements will not be
validated. Using XSV you would get the message "validation=lax" since strict
validation can't be used.
I'm not 100% certain so about this so please correct me if I'm wrong.

/Eddie

> instance document:
> <?xml version="1.0" ?>
> <mo xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
>    <larry>
>        <a xmlns="urn:TestA"
>           xsi:schemaLocation="urn:TestA testa.xsd" >
>           hello
>        </a>
>        <curly/>
>        <r xmlns="urn:TestR"
>           xsi:schemaLocation="urn:TestR testr.xsd">
>           goodbye
>        </r>
>    </larry>
> </mo>
>
> testr.xsd:
> <?xml version="1.0"?>
> <xsd:schema targetNamespace="urn:TestR"
>             xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>             elementFormDefault="qualified">
>         <xsd:element name="r" type="xsd:string"/>
> </xsd:schema>
>
> testa.xsd:
> <?xml version="1.0"?>
> <xsd:schema targetNamespace="urn:TestA"
>             xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>             elementFormDefault="qualified">
>         <xsd:element name="a" type="xsd:string"/>
> </xsd:schema>
Received on Wednesday, 7 February 2001 23:23:25 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC