String localName,
Attributes list)
throws SAXException {
try {
// use the URI to load a taglib
TagLibrary taglib = context.getTagLibrary(namespaceURI);
if (taglib == null) {
if (namespaceURI != null && namespaceURI.startsWith("jelly:")) {
String uri = namespaceURI.substring(6);
// try to find the class on the claspath
try {
Class taglibClass = getClassLoader().loadClass(uri);
taglib = (TagLibrary) taglibClass.newInstance();
context.registerTagLibrary(namespaceURI, taglib);
}
catch (ClassNotFoundException e) {
throw createSAXException("Could not load class: " + uri + " so taglib instantiation failed", e);
}
catch (IllegalAccessException e) {
throw createSAXException("Constructor for class is not accessible: " + uri + " so taglib instantiation failed",e);
}
catch (InstantiationException e) {
throw createSAXException("Class could not be instantiated: " + uri + " so taglib instantiation failed",e);
}
catch (ClassCastException e) {
throw createSAXException("Class is not a TagLibrary: " + uri + " so taglib instantiation failed",e);
}
}
}
if (taglib != null) {
TagScript script = taglib.createTagScript(localName, list);
if ( script != null ) {
configureTagScript(script);
// clone the attributes to keep them around after this parse
script.setSaxAttributes(new AttributesImpl(list));
// now iterate through through the expressions
int size = list.getLength();
for (int i = 0; i < size; i++) {
String attributeName = list.getLocalName(i);
String attributeValue = list.getValue(i);
Expression expression =
taglib.createExpression(
getExpressionFactory(),
script,
attributeName,
attributeValue);
if (expression == null) {