Hello,
I have wriite a mediator for validation, in my schema one <xsd:include> is also there.
I created two entries in Integrated Registry
Schema/s1/File.xsd - content of child schema file
Schema/s1/OutputMessage.xsd - content of parent schema file
Source validateSrc = SynapseConfigUtils.getStreamSource(synCtx.getEntry("Schema/s1/xmlFile"));
ArrayList<String> schemaKeys = new ArrayList<String>();
schemaKeys.add("Schema/s1/OutputMessage.xsd"); //parent xsd key from registry
// schemaKeys.add("Schema/s1/File.xsd"); - i tried using this also, but it is now working
// in OutputMessage.xsd - i am tried with giving "Schema/s1/File.xsd" as schemaLocation in the registry also but still no chance....
StreamSource[] sources = new StreamSource[schemaKeys.size()];
int i = 0;
for (String propName : schemaKeys) {
sources[i++] = SynapseConfigUtils.getStreamSource(synCtx.getEntry(propName));
}
cachedSchema = factory.newSchema(sources);
Validator validator = cachedSchema.newValidator();
System.out.println("===before validate()");
validator.validate(validateSrc);
System.out.println("===after validate()");
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
return false;
}
I am receivng the following error - essentially it is not resolving the child xsd file.
I have the respective files also...
---Krishna
| Attachment | Size |
|---|---|
| OutputMessage.xml | 252 bytes |
| File.xsd | 377 bytes |
| OutputMessage.xsd | 531 bytes |
It works for me , when I use shemas in a order ...
my need is little different