if(elementSUs != null) {
int numSUs = elementSUs.size();
for(int i = 0; i < numSUs; i++) {
ContentHandlerConfigMap configMap = elementSUs.get(i);
SmooksResourceConfiguration config = configMap.getResourceConfig();
// Make sure the serialization unit is targeted at this element.
if(!config.isTargetedAtElement(element, executionContext)) {
continue;
}
// Register the targeting event...
if(eventListener != null) {
eventListener.onEvent(new ResourceTargetingEvent(element, config));
}
if(logger.isDebugEnabled()) {
logger.debug("Applying serialisation resource [" + config + "] to element [" + DomUtils.getXPath(element) + "].");
}
// This is the one, return it...
return (SerializationUnit)configMap.getContentHandler();
}
}
return defaultSerializationUnit;
}