FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Ver 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
set a LSResourceResolver to the SchemaFactory and Validator won't work.
SchemaFactory fact = ...
fact.setResourceResolver(new LSResourceResolver() {
public LSInput resolveResource(String type,
String namespaceURI,
String publicId,
String systemId,
String baseURI) {
System.out.println("---- ---- FACTORY ---- ----");
System.out.println("type = " + type);
System.out.println("namespaceURI = " +
namespaceURI);
System.out.println("publicId = " + publicId);
System.out.println("systemId = " + systemId);
System.out.println("baseURI = " + baseURI);
System.out.println("---- ---- ---- ----");
return null;
}
});
Validator val = JaxpValidatorDelegator.newValidator();
val.setResourceResolver(new LSResourceResolver() {
public LSInput resolveResource(String type,
String namespaceURI,
String publicId,
String systemId,
String baseURI) {
System.out.println("---- ---- VALIDATOR ---- ----");
System.out.println("type = " + type);
System.out.println("namespaceURI = " +
namespaceURI);
System.out.println("publicId = " + publicId);
System.out.println("systemId = " + systemId);
System.out.println("baseURI = " + baseURI);
System.out.println("---- ---- ---- ----");
return null;
}
});
val.validate(new StreamSource(file));
the result doesn't contain any message. but if I use Xerces 2.9.1(org.apache.xerces.jaxp.validation.XMLSchemaFactory)
I got the message like:
---- ---- VALIDATOR ---- ----
type = http://www.w3.org/2001/XMLSchema
namespaceURI = http://www.example.com/IPO/address
publicId = null
systemId = addressv2.xsd
baseURI = file:///D:/Workspace/Zone/JAXP_Validation/commons_jaxp_validation/po/ipov2.xsd
---- ---- ---- ----
It seems that the default one in JDK5(com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl) do not support setResourceResolver(LSResourceResolver resourceResolver).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should print out the message like:
---- ---- VALIDATOR ---- ----
type = http://www.w3.org/2001/XMLSchema
namespaceURI = http://www.example.com/IPO/address
publicId = null
systemId = addressv2.xsd
baseURI = file:///D:/Workspace/Zone/JAXP_Validation/commons_jaxp_validation/po/ipov2.xsd
---- ---- ---- ----
ACTUAL -
Nothing printed out.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Using Xerces 2.9.1.
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Ver 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
set a LSResourceResolver to the SchemaFactory and Validator won't work.
SchemaFactory fact = ...
fact.setResourceResolver(new LSResourceResolver() {
public LSInput resolveResource(String type,
String namespaceURI,
String publicId,
String systemId,
String baseURI) {
System.out.println("---- ---- FACTORY ---- ----");
System.out.println("type = " + type);
System.out.println("namespaceURI = " +
namespaceURI);
System.out.println("publicId = " + publicId);
System.out.println("systemId = " + systemId);
System.out.println("baseURI = " + baseURI);
System.out.println("---- ---- ---- ----");
return null;
}
});
Validator val = JaxpValidatorDelegator.newValidator();
val.setResourceResolver(new LSResourceResolver() {
public LSInput resolveResource(String type,
String namespaceURI,
String publicId,
String systemId,
String baseURI) {
System.out.println("---- ---- VALIDATOR ---- ----");
System.out.println("type = " + type);
System.out.println("namespaceURI = " +
namespaceURI);
System.out.println("publicId = " + publicId);
System.out.println("systemId = " + systemId);
System.out.println("baseURI = " + baseURI);
System.out.println("---- ---- ---- ----");
return null;
}
});
val.validate(new StreamSource(file));
the result doesn't contain any message. but if I use Xerces 2.9.1(org.apache.xerces.jaxp.validation.XMLSchemaFactory)
I got the message like:
---- ---- VALIDATOR ---- ----
type = http://www.w3.org/2001/XMLSchema
namespaceURI = http://www.example.com/IPO/address
publicId = null
systemId = addressv2.xsd
baseURI = file:///D:/Workspace/Zone/JAXP_Validation/commons_jaxp_validation/po/ipov2.xsd
---- ---- ---- ----
It seems that the default one in JDK5(com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl) do not support setResourceResolver(LSResourceResolver resourceResolver).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should print out the message like:
---- ---- VALIDATOR ---- ----
type = http://www.w3.org/2001/XMLSchema
namespaceURI = http://www.example.com/IPO/address
publicId = null
systemId = addressv2.xsd
baseURI = file:///D:/Workspace/Zone/JAXP_Validation/commons_jaxp_validation/po/ipov2.xsd
---- ---- ---- ----
ACTUAL -
Nothing printed out.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Using Xerces 2.9.1.