*
* @return
* @throws ServletException
*/
protected HTMLConfiguration getHtmlConfig() {
HTMLConfiguration _config = new HTMLConfiguration();
try {
if (this.getPublicid() != null || this.getSystemid() != null) {
_config.setFeature(
"http://cyberneko.org/html/features/insert-doctype",
true);
_config.setFeature(
"http://cyberneko.org/html/features/override-doctype",
true);
}
if (this.getPublicid() != null) {
_config.setProperty(
"http://cyberneko.org/html/properties/doctype/pubid",
getPublicid());
}
if (this.getSystemid() != null) {
_config.setProperty(
"http://cyberneko.org/html/properties/doctype/sysid",
getSystemid());
}
if (this.getNamespace() != null) {
_config.setFeature("http://xml.org/sax/features/namespaces",
true);
_config
.setFeature(
"http://cyberneko.org/html/features/override-namespaces",
true);
_config.setFeature(
"http://cyberneko.org/html/features/insert-namespaces",
true);
_config.setProperty(
"http://cyberneko.org/html/properties/namespaces-uri",
getNamespace());
}
// config
// .setFeature(
// "http://cyberneko.org/html/features/balance-tags/ignore-outside-content",
// true);
_config
.setFeature(
"http://cyberneko.org/html/features/scanner/cdata-sections",
true);
_config
.setFeature(
"http://cyberneko.org/html/features/scanner/script/strip-comment-delims",
true);
_config
.setFeature(
"http://cyberneko.org/html/features/scanner/style/strip-comment-delims",
true);
_config.setFeature(
"http://cyberneko.org/html/features/insert-doctype", true);
_config.setFeature(
"http://cyberneko.org/html/features/insert-namespaces",
true);
//
// Set properties
// http://cyberneko.org/html/features/insert-namespaces
// _config
// .setProperty(
// "http://cyberneko.org/html/properties/default-encoding",
// encoding);
_config
.setProperty(
"http://cyberneko.org/html/properties/names/elems",
"lower");
_config
.setProperty(
"http://cyberneko.org/html/properties/names/attrs",
"lower");
_config.setProperty("http://cyberneko.org/html/properties/filters",
_filters);
} catch (XMLConfigurationException e) {
// throw new ServletException("error set Neko feature ", e);
}
return _config;