- From: Kriegesmann, Peter <Peter.Kriegesmann@softwareag.com>
- Date: Fri, 15 Nov 2002 13:02:08 +0100
- To: xmlschema-dev@w3.org
Hello friends of the XML schema, Today I have a question about the correctness of using xs:import statement without namespace attribute. As I understood the spec the following schema A has no errors: 1. Schema A.xsd <xs:schema xmlns:cst="<http://myTargetNamespace>" xmlns:xs="<http://www.w3.org/2001/XMLSchema>" targetNamespace="<http://myTargetNamespace>"> <xs:import schemaLocation="<http://www.schematesting.org/B.XSD>"/> <xs:element type="globalTestComplexType" name="testGLobalComplexType"/> </xs:schema> 2. Schema B.xsd <xs:schema xmlns:xs = "<http://www.w3.org/2001/XMLSchema>"> <xs:complexType name="globalTestComplexType"> <xs:simpleContent> <xs:extension base="xs:boolean"> <xs:attribute name="testAttribute2" use="required"/> <xs:anyAttribute/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:schema> According to the W3C speficification (http://www.w3.org/TR/xmlschema-1/#element-import <http://www.w3.org/TR/xmlschema-1/>) the schema "A.xsd" should be fine. Here is my explanation: 1. Schema A.xsd must have a "targetNamespace" attribute (according to spec) 2. When the parser encounters the element definition of "testGLobalComplexType" in A.xsd, he analyses if there is such a global type definition. Since there is a targetNamespace-definition but no xmlns="..." declaration and also no global type definition he follows the hints of the xs:import element 3. Within B.xsd the parser finds a global type definition named "globalTestComplexType" 4. Now the parser only has to check if B.xsd has no targetNamespace defined, because then the types again wouldn't match 5. Since this is not the case, schema "A.xsd" follows the W3C standards and has no errors. Best regards, Peter ---------------------------------------------------------------------------- ----------------------------------------------------------------- "Die Welt ist so groß, dass alle Irrtümer darin Platz haben." Rudolf Augstein (1923 - 2002) ---------------------------------------------------------------------------- ----------------------------------------------------------------- Peter Kriegesmann Phone 06151-921484 Electronic Business Technologies (QE) Fax 06151-921612 Software AG http://www.softwareag.com Uhlandstrasse 12 D-64297 Darmstadt mailto:Peter.Kriegesmann@softwareag.com
Received on Friday, 15 November 2002 07:02:16 UTC