src-resolve: Cannot resolve the name 'ds:Signature' to an 'element declaration' component
If you have xmldsig-core-schema.xsd
in the same directory as your XSD, and if it is the same as this XSD, then you should not be getting an error about a failure to resolve ds:Signature
.
Therefore, I suspect that your import is failing, and you're missing or ignoring a warning such as the following:
[Warning] try.xsd:9:56: schema_reference.4: Failed to read schema document 'xmldsig-core-schema.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not
<xsd:schema>
.
Try this XSD as a test; it loads directly from the URL for xmldsig-core-schema.xsd
:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:abc="http://abc.123.com"
targetNamespace="http://abc.123.com"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/>
<xs:complexType name="headerType">
<xs:sequence>
<xs:element name="doorNumber" type="xs:int"/>
<xs:element ref="ds:Signature"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
I've tested the above XSD and found that it eliminates the resolution error that you were seeing.
As an alternative you can cache locally the xmldsig-core-schema.xsd
, put it in the same directory of your xsd schema, an then let your original
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
This will resolve your problem of importing a file from W3C website and save time of execution.