Hi, Jean-Guillaume, > Jean-Guillaume LALANNE wrote: > - my schemas are not valid and xerces is right and XMLSpy > not.
I believe Xerces is right. According to schema specs if there is a namespace attribute is present, then its value must be identical to the value of the targetNamespace attribute of imported schema. If there is no namespace attribute, then imported Schema must have no targetNamespace attribute. In your shoppingcartline.xsd you have *targetNamespace* attribute, thus then importing it you should specify *namespace* attribute on import. See 6.2.3 (Schema Part 1): "The normalized value of its namespace [attribute] indicates that the containing schema document may contain qualified references to schema components in that namespace (via one or more prefixes declared with namespace declarations in the normal way). If that attribute is absent, then the import allows unqualified reference to components with no target namespace." Elena > - the opposite. > > Here are my schemas : > > File : shoppingcartline.xsd > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema > > targetNamespace="http://www.toto.com/validation/Schemas/toto-shoppingcartline" > > xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" > > xmlns:toto-shoppingcartline="http://www.toto.com/validation/Schemas/toto-shoppingcartline"> > > <xsd:element name="shoppingcartline"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="toto-shoppingcartline:pK"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > > <xsd:element name="pK" type="xsd:int" /> > > </xsd:schema> > > File : shoppingcart.xsd > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema > > targetNamespace="http://www.toto.com/validation/Schemas/toto-shoppingcart" > > xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" > > xmlns:toto-shoppingcart="http://www.toto.com/validation/Schemas/toto-shoppingcart" > > xmlns:toto-shoppingcartline="http://www.toto.com/validation/Schemas/toto-shoppingcartline"> > > <xsd:import schemaLocation="shoppingcartline.xsd"/> > > <xsd:element name="shoppingcart"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="toto-shoppingcart:pK"/> > <xsd:element ref="toto-shoppingcart:list-shoppingcartline"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > > <xsd:element name="pK" type="xsd:int" /> > > <xsd:element name="list-shoppingcartline"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="toto-shoppingcartline:shoppingcartline" > minOccurs="0" maxOccurs="unbounded"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > > </xsd:schema> > > > File : shoppingcart.xml > > <?xml version="1.0" encoding="UTF-8"?> > <shoppingcart > > xmlns="http://www.toto.com/validation/Schemas/toto-shoppingcart" > > xmlns:toto-shoppingcartline="http://www.toto.com/validation/Schemas/toto-shoppingcartline" > xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" > > xsi:schemaLocation="http://www.toto.com/validation/Schemas/whip-shoppingcart > shoppingcart.xsd"> > > <pK>2</pK> > <list-shoppingcartline> > <toto-shoppingcartline:shoppingcartline> > <toto-shoppingcartline:pK>555</toto-shoppingcartline:pK> > <toto-shoppingcartline:quantity>888</toto-shoppingcartline:quantity> > </toto-shoppingcartline:shoppingcartline> > </list-shoppingcartline> > </shoppingcart> > > This previous file is valid for XMLSpy but it is NOT for xerces1.3.0. > I got the following error message : > > [error] file:///shoppingcart.xml 6:96 Schema error: imported schema > 'shoppingcartline.xsd,shoppingcartline.xsd' > has a different targetNameSpace > 'http://www.toto.com/validation/Schemas/toto-shoppingcartline' from > what is declared ''.. > > Where am I wrong ? > > > Any suggestion is appreciated. > Thanks a lot. > Jean-Guillaume LALANNE > [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
