W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2007

Re: cannot validate xml with remote schema

From: George Cristian Bina <george@oxygenxml.com>
Date: Fri, 14 Sep 2007 18:08:20 +0300
Message-ID: <46EAA3E4.1080703@oxygenxml.com>
To: SINGH Navpreet <Navpreet.SINGH@Tenix.com>
Cc: xmlschema-dev@w3.org

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

This archive was generated by hypermail 2.3.1 : Wednesday, 10 December 2014 20:01:58 UTC