use of org.apache.commons.configuration2.builder.fluent.XMLBuilderParameters in project engine by craftercms.
the class ConfigUtils method readXmlConfiguration.
public static XMLConfiguration readXmlConfiguration(Resource resource, char listDelimiter, Map<String, Lookup> prefixLookups) throws ConfigurationException {
Parameters params = new Parameters();
FileBasedConfigurationBuilder<XMLConfiguration> builder = new FileBasedConfigurationBuilder<>(XMLConfiguration.class);
try {
XMLBuilderParameters xmlParams = params.xml().setURL(resource.getURL()).setListDelimiterHandler(new DefaultListDelimiterHandler(listDelimiter));
if (MapUtils.isNotEmpty(prefixLookups)) {
xmlParams = xmlParams.setPrefixLookups(prefixLookups);
}
builder.configure(xmlParams);
} catch (IOException e) {
throw new ConfigurationException("Unable to get URL of resource " + resource, e);
}
return builder.getConfiguration();
}
Aggregations