Hi,
 
I am using in parallel XMLSpy and xerces1.3.0 and I am confronted to the following problem.
I am managing to validate an xml document in XMLSpy and I don't manage to do so in xerces.
I am wondering if :
            - my schemas are not valid and xerces is right and XMLSpy not.
            - 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

 

Reply via email to