Re: cannot validate xml with remote schema

One schema defines the elements in no namespace and the other in the 
http://a995760/pub/Resources/Validation namespace. In any case the local 
elements are in no namespace thus the remote schema validates something 
like:

<?xml version="1.0" encoding="UTF-8"?>
<loadInstructions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://a995760/pub/Resources/Validation"
    xsi:schemaLocation="http://a995760/pub/Resources/Validation
    test.xsd">
    <test xmlns="">test</test>
    <test1 xmlns="">3</test1>
</loadInstructions>

To have the local elements in the remote schema defined in the same 
namespace as the global element you need something like below:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://a995760/pub/Resources/Validation"
   elementFormDefault="qualified">
   <xs:element name="loadInstructions">
     <xs:complexType>
       <xs:sequence>
         <xs:element name="test"
           type="xs:string"/>
         <xs:element name="test1"
           type="xs:integer"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
</xs:schema>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Received on Friday, 14 September 2007 15:10:08 UTC