- From: Eddie Robertsson <eddie@allette.com.au>
- Date: Tue, 06 Mar 2001 12:46:15 +1100
- To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
- CC: Matt Brown <matt@avolent.com>, "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
- Message-ID: <3AA44167.BD955C45@allette.com.au>
"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:sch="http://www.ascc.net/xml/schematron_part"
xmlns="www.allette.com.au/Tournament"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<xsd:element name="Tournament">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Type" type="xsd:string">
<xsd:annotation>
<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>
</sch:rule>
</sch:pattern>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
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"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="www.allette.com.au/Tournament Test.xsd">
<Type>Doubles</Type>
</Tournament>
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???
Cheers,
/Eddie
part.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.ascc.net/xml/schematron_part"
xmlns="http://www.ascc.net/xml/schematron_part"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<xsd:element name="pattern">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="rule" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="assert" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="test" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="context" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Received on Monday, 5 March 2001 20:46:58 UTC