include xmldsig schema in another one

I have an xml document that I want to sign and to be able to validate
against xml schema.

I got the schema for xmldsig at
http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd 

and included it in the following xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
 xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
 xmlns:xs="http://www.w3.org/2001/XMLSchema" 
 elementFormDefault="qualified" 
 attributeFormDefault="unqualified">
  <xs:import 
   namespace="http://www.w3.org/2000/09/xmldsig#" 
   schemaLocation="xmldsig-core-schema.xsd"/>
  <xs:element name="test">
    <xs:complexType>
      <xs:sequence>
  <xs:element ref="ds:Signature"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Now, when I try to validate an xml file with Xerces-J 2.6.2, I run in 

** Parsing error, line 10, uri file:///C:/test.xsd
   src-resolve: Cannot resolve the name 'dg:Signature' to a(n) 'element declaration' component.

whatever I do. 

What is even more surprising is that the same document validates perfectly 
in XML Spy 4.3. Any hints on what goes wrong?
-- 
Alexander Mikhailian

Received on Friday, 17 September 2004 16:53:33 UTC