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

Re: assigning schema to appInfo elements

From: Eddie Robertsson <eddie@allette.com.au>
Date: Tue, 06 Mar 2001 12:46:15 +1100
Message-ID: <3AA44167.BD955C45@allette.com.au>
To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
CC: Matt Brown <matt@avolent.com>, "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
"Henry S. Thompson" wrote:

> Matt Brown <matt@avolent.com> writes:
> > + specifying appInfo like this:
> >
> >     <appInfo xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> >              xsi:noTargetNamspace="appInfoSchema.xsd">
> >         <className>org.foo.bar.MyClass</className>
> >         <mapping method="FirstName" element="firstName" type="boolean"/>
> >     </appInfo>
> This is an entirely reasonable approach, and works with XSV [1].

I found this very interesting so I decided to try it out. Unfortunately I can't
get it to work properly with XSV. Here is my XML Schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="www.allette.com.au/Tournament"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
 <xsd:element name="Tournament">
    <xsd:element name="Type" type="xsd:string">
      <xsd:appinfo xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="http://www.ascc.net/xml/schematron_part part.xsd">
       <!-- Each appinfo with schematorn information need to be on the pattern
level. -->
       <sch:pattern name="Check participants for single and double matches.">
        <sch:rule context="t:Type[text() = 'Singles']">
         <sch:assert test="../t:Participants/@nbrParticipants >= 2">If you're
playing single matches there must be at least 2 participants.</sch:assert>

This is from the example I posted a couple of days ago where I included
schematron information in the appinfo of an XML Schema (Note, that this example
has been cut down for testing purposes only). Now, I've created an XML Schema
for a subset of Schematron in the file part.xsd (see end of email). However,
when I run the online version of XSV with the following instance:

<?xml version="1.0" encoding="UTF-8"?>
<Tournament xmlns="www.allette.com.au/Tournament"
xsi:schemaLocation="www.allette.com.au/Tournament Test.xsd">

I get the following message:

Schema validating with XSV 1.176/1.87 of 2001/02/16 16:38:43
*No declaration for document root found, validation was lax   (I don't
understand this...)
*schemaLocs: www.allette.com.au/Tournament -> Test.xsd
*The schema(s) used for schema-validation had no errors
*No schema-validity problems were found in the target

Schema resources involved

Attempt to import a schema document from
http://www.allette.com.au/Demo/XSV/test/Test.xsd for
www.allette.com.au/Tournament, failed

Attempt to import a schema document from
http://www.allette.com.au/Demo/XSV/test/www.allette.com.au/Tournament for
www.allette.com.au/Tournament, failed

(I find this last import attempt very strange...)

If I remove the schemaLocation information from the appinfo element everything
works fine so maybe I misunderstood the way to validate the information in the
appinfo element???



<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.ascc.net/xml/schematron_part"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
 <xsd:element name="pattern">
    <xsd:element name="rule" maxOccurs="unbounded">
       <xsd:element name="assert" maxOccurs="unbounded">
          <xsd:extension base="xsd:string">
           <xsd:attribute name="test" type="xsd:string"/>
      <xsd:attribute name="context" type="xsd:string"/>
   <xsd:attribute name="name" type="xsd:string"/>
Received on Monday, 5 March 2001 20:46:58 UTC

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