in jelly-tags/validate/src/main/java/org/apache/commons/jelly/tags/validate/VerifierTag.java [61:113]
public void doTag(final XMLOutput output) throws MissingAttributeException, JellyTagException {
if ( var == null ) {
throw new MissingAttributeException("var");
}
InputStream in = null;
if ( uri != null ) {
in = context.getResourceAsStream( uri );
if ( in == null ) {
throw new JellyTagException( "Could not find resource for uri: " + uri );
}
} else if (file != null) {
try {
in = new FileInputStream(file);
} catch (FileNotFoundException e) {
throw new JellyTagException(e);
}
} else {
String text = getBodyText();
in = new ByteArrayInputStream( text.getBytes() );
}
Verifier verifier = null;
try {
Schema schema = null;
if (systemId != null) {
schema = getFactory().compileSchema(in, systemId);
}
else if ( uri != null ) {
schema = getFactory().compileSchema(in, uri);
}
else{
schema = getFactory().compileSchema(in);
}
if ( schema == null ) {
throw new JellyTagException( "Could not create a valid schema" );
}
verifier = schema.newVerifier();
}
catch (VerifierConfigurationException e) {
throw new JellyTagException(e);
}
catch (SAXException e) {
throw new JellyTagException(e);
}
catch (IOException e) {
throw new JellyTagException(e);
}
context.setVariable(var, verifier);
}