return saxConfig;
}
}
private StreamFilterType getStreamFilterType() {
StreamFilterType filterType;
if(logger.isDebugEnabled()) {
logger.debug("SAX/DOM support characteristics of the Resource Configuration map:\n" + getResourceFilterCharacteristics());
}
String filterTypeParam = ParameterAccessor.getStringParameter(Filter.STREAM_FILTER_TYPE, resourceConfigTable);
if(visitorConfig.getSaxVisitorCount() == visitorConfig.getVisitorCount() && visitorConfig.getDomVisitorCount() == visitorConfig.getVisitorCount()) {
if(filterTypeParam == null) {
filterType = StreamFilterType.SAX;
logger.debug("All configured XML Element Content Handler resource configurations can be " +
"applied using the SAX or DOM Stream Filter. Defaulting to " + filterType + " Filter. Set '" + ParameterAccessor.GLOBAL_PARAMETERS + ":"
+ Filter.STREAM_FILTER_TYPE + "'.");
logger.debug("You can explicitly select the Filter type as follows:\n" +
"\t\t<resource-config selector=\"" + ParameterAccessor.GLOBAL_PARAMETERS + "\">\n" +
"\t\t\t<param name=\"" + Filter.STREAM_FILTER_TYPE + "\">SAX/DOM</param>\n" +
"\t\t</resource-config>");
} else if(filterTypeParam.equalsIgnoreCase(StreamFilterType.DOM.name())) {
filterType = StreamFilterType.DOM;
} else if(filterTypeParam.equalsIgnoreCase(StreamFilterType.SAX.name())) {
filterType = StreamFilterType.SAX;
} else {
throw new SmooksException("Invalid '" + Filter.STREAM_FILTER_TYPE + "' configuration parameter value of '" + filterTypeParam + "'. Must be 'SAX' or 'DOM'.");
}
} else if(visitorConfig.getDomVisitorCount() == visitorConfig.getVisitorCount()) {
filterType = StreamFilterType.DOM;
} else if(visitorConfig.getSaxVisitorCount() == visitorConfig.getVisitorCount()) {
filterType = StreamFilterType.SAX;
} else {
throw new SmooksException("Ambiguous Resource Configuration set. All Element Content Handlers must support processing on the SAX and/or DOM Filter:\n" + getResourceFilterCharacteristics());
}
// If the filter type has been configured, we make sure the selected filter matches...
if(filterTypeParam != null) {
if(!filterTypeParam.equalsIgnoreCase(filterType.name())) {
throw new SmooksException("The configured Filter ('" + filterTypeParam + "') cannot be used with the specified set of Smooks visitors. The '" + filterType + "' Filter is the only filter that can be used for this set of Visitors. Turn on Debug logging for more information.");
}
}
return filterType;