Validation of XML Schema by other XML Schema
Posted: Tue Aug 24, 2004 7:28 pm
Dear colleagues,
My overall goal is to develop XML Schema for domains-specific XML Schemas. I'm trying to do so following the hints given in the article at http://www.xml.com/pub/a/2002/10/02/metaschema.html.
Is there some way how to force Oxygen to use my own XML Schema for http://www.w3.org/2001/XMLSchema namespace instead of some built-in one? I searched the Options|Properties and there is nothing like that. I'm quite sure that it is not enough to set the schemaLocation attribute (yes, I know that W3C specs do not require processor to handle schemaLocation attribute).
My current testcase is the following.The first code snip is an empty instance XML Schema that is validated by Oxygen. I require it to be validated by XMLSchemaErrated.xsd schema downloaded from http://www.w3.org/2001/XMLSchema.xsd (which I renamed). To ensure myself that the downloaded schema is used for validation I modified definition of xs:schema element -- 1) I changed the type of targetNamespace attribute from xs:anyURI to xs:nonNegativeInteger and 2) I added mandatory attribute xxx. Both changes are marked with bold font in the second code snip, where I show the relevant part of xs:schema element of XMLSchemaErrated.xsd. The expected result is that the schema instance (the first code snip) bellow will not be validated with two errors. However it is validated.
My question is: What is wrong?
--- code snip 1 ---
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
targetNamespace="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchemaErrated.xsd"
>
</xs:schema>
--- code snip 1 ---
--- code snip 2 ---
<xs:element name="schema" id="schema">
<xs:annotation>
<xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:openAttrs">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="xs:include"/>
<xs:element ref="xs:import"/>
<xs:element ref="xs:redefine"/>
<xs:element ref="xs:annotation"/>
</xs:choice>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:group ref="xs:schemaTop"/>
<xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:sequence>
<xs:attribute name="targetNamespace" type="xs:nonNegativeInteger"/>
<xs:attribute name="version" type="xs:token"/>
<xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
<xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
<xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
<xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute name="xxx" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
...
</xs:element>
--- code snip 2 ---
Thank you for your help!
Regards,
Ondrej
PS: (off-topic) note: I have schema-full-checking in on
My overall goal is to develop XML Schema for domains-specific XML Schemas. I'm trying to do so following the hints given in the article at http://www.xml.com/pub/a/2002/10/02/metaschema.html.
Is there some way how to force Oxygen to use my own XML Schema for http://www.w3.org/2001/XMLSchema namespace instead of some built-in one? I searched the Options|Properties and there is nothing like that. I'm quite sure that it is not enough to set the schemaLocation attribute (yes, I know that W3C specs do not require processor to handle schemaLocation attribute).
My current testcase is the following.The first code snip is an empty instance XML Schema that is validated by Oxygen. I require it to be validated by XMLSchemaErrated.xsd schema downloaded from http://www.w3.org/2001/XMLSchema.xsd (which I renamed). To ensure myself that the downloaded schema is used for validation I modified definition of xs:schema element -- 1) I changed the type of targetNamespace attribute from xs:anyURI to xs:nonNegativeInteger and 2) I added mandatory attribute xxx. Both changes are marked with bold font in the second code snip, where I show the relevant part of xs:schema element of XMLSchemaErrated.xsd. The expected result is that the schema instance (the first code snip) bellow will not be validated with two errors. However it is validated.
My question is: What is wrong?
--- code snip 1 ---
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
targetNamespace="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchemaErrated.xsd"
>
</xs:schema>
--- code snip 1 ---
--- code snip 2 ---
<xs:element name="schema" id="schema">
<xs:annotation>
<xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:openAttrs">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="xs:include"/>
<xs:element ref="xs:import"/>
<xs:element ref="xs:redefine"/>
<xs:element ref="xs:annotation"/>
</xs:choice>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:group ref="xs:schemaTop"/>
<xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:sequence>
<xs:attribute name="targetNamespace" type="xs:nonNegativeInteger"/>
<xs:attribute name="version" type="xs:token"/>
<xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
<xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
<xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
<xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute name="xxx" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
...
</xs:element>
--- code snip 2 ---
Thank you for your help!
Regards,
Ondrej
PS: (off-topic) note: I have schema-full-checking in on