I am pretty new to xsds, and currently the xsd I am using is only validating on some machines. It works on my local machine, but when I try doing this on a machine where there are some proxies or firewalls, it no longer works. The schemas I am using are used locally, though.
Here is the error I get when the xsd schema is attempting to validate:
src-resolve: Cannot resolve the name 'xenc:EncryptedDataType' to a(n) 'type definition' component.
Which comes from this code:
boolean validate(URL schemaUrl) {
SchemaFactory schemaFactory = SchemaFactory
.newInstance("http://www.w3.org/2001/XMLSchema");
Schema schema = null;
try {
schema = schemaFactory.newSchema(schemaUrl); //this is where the exception is thrown
} catch (SAXException e) {
//exception is caught here
return false;
}
//... more code here
}
The error has the same stack trace as this one: SAXParseException; src-resolve: Cannot resolve the name '...' to a(n) 'type definition' component
I have my main xsd that begins something like this:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:tns="http://customization.elster.com/shipment"
targetNamespace="http://customization.client.com/introduction"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
version="1.1" >
<xs:import namespace="http://www.w3.org/2001/04/xmlenc#" schemaLocation="xenc-schema.xsd"/>
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
in this main XML I need the "xenc:EncryptedDataType"
<xs:complexType name="NamedEncryptedDataType">
<xs:complexContent>
<xs:extension base="xenc:EncryptedDataType">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
which is defined in the xenc-schema.xsd (which is in the same folder as my main xsd)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSchema 200102//EN"
"http://www.w3.org/2001/XMLSchema.dtd"
[
<!ATTLIST schema
xmlns:xenc CDATA #FIXED 'http://www.w3.org/2001/04/xmlenc#'
xmlns:ds CDATA #FIXED 'http://www.w3.org/2000/09/xmldsig#'>
<!ENTITY xenc 'http://www.w3.org/2001/04/xmlenc#'>
<!ENTITY % p ''>
<!ENTITY % s ''>
]>
<schema xmlns='http://www.w3.org/2001/XMLSchema' version='1.0'
xmlns:xenc='http://www.w3.org/2001/04/xmlenc#'
xmlns:ds='http://www.w3.org/2000/09/xmldsig#'
targetNamespace='http://www.w3.org/2001/04/xmlenc#'
elementFormDefault='qualified'>
<import namespace='http://www.w3.org/2000/09/xmldsig#'
schemaLocation='xmldsig-core-schema.xsd'/>
in this xenc-schema, there is the culprit data type:
<element name='EncryptedData' type='xenc:EncryptedDataType'/>
<complexType name='EncryptedDataType'>
<complexContent>
<extension base='xenc:EncryptedType'>
</extension>
</complexContent>
</complexType>
I've tried to keep this question shorter, let me know if more information is needed, thanks for reading.