*
* @return
* @throws CamelException
*/
protected XMLReader createTagSoupParser() throws CamelException {
XMLReader reader = new Parser();
try {
reader.setFeature(Parser.namespacesFeature, false);
reader.setFeature(Parser.namespacePrefixesFeature, false);
/*
* set each parser feature that the user may have supplied.
* http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html
* http://home.ccil.org/~cowan/XML/tagsoup/#properties
*/
if (getParserFeatures() != null) {
for (Entry<String, Boolean> e : getParserFeatures().entrySet()) {
reader.setFeature(e.getKey(), e.getValue());
}
}
/*
* set each parser feature that the user may have supplied. {@link
* http://home.ccil.org/~cowan/XML/tagsoup/#properties}
*/
if (getParserPropeties() != null) {
for (Entry<String, Object> e : getParserPropeties().entrySet()) {
reader.setProperty(e.getKey(), e.getValue());
}
}
/*
* default the schema to HTML
*/
if (this.getParsingSchema() != null) {
reader.setProperty(Parser.schemaProperty, getParsingSchema());
}
} catch (Exception e) {
throw new IllegalArgumentException("Problem configuring the parser", e);
}