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

Can schemas validate parts of an instance document?

From: Tom Gaven <tom.gaven@xmls.com>
Date: Wed, 7 Feb 2001 22:39:52 -0500
To: <xmlschema-dev@w3.org>
Message-ID: <000301c09180$cc6079d0$6420183f@xmls>
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?

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 22:40:36 UTC

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