Added namespace fail safe

pull/207/head
M66B 3 years ago
parent 4e38642fb6
commit f9966f7a62

@ -1584,7 +1584,8 @@ public class HtmlHelper {
for (Element e : parsed.select("*")) { for (Element e : parsed.select("*")) {
String tag = e.tagName(); String tag = e.tagName();
if (tag.contains(":")) { if (tag.contains(":")) {
boolean show = ("body".equals(tag) || ns == null || tag.startsWith(ns)); boolean show = (ns == null || tag.startsWith(ns) ||
tag.startsWith("html:") || tag.startsWith("body:"));
if (display_hidden || show) { if (display_hidden || show) {
String[] nstag = tag.split(":"); String[] nstag = tag.split(":");
e.tagName(nstag[nstag.length > 1 ? 1 : 0]); e.tagName(nstag[nstag.length > 1 ? 1 : 0]);
@ -1598,16 +1599,16 @@ public class HtmlHelper {
e.remove(); e.remove();
Log.i("Removed tag=" + tag); Log.i("Removed tag=" + tag);
} }
} } else if (!"html".equals(tag) && !"body".equals(tag)) {
String xmlns = e.attr("xmlns").toLowerCase(Locale.ROOT);
String xmlns = e.attr("xmlns").toLowerCase(Locale.ROOT); if (!TextUtils.isEmpty(xmlns) && !xmlns.contains(W3NS)) {
if (!TextUtils.isEmpty(xmlns) && !xmlns.contains(W3NS)) { if (display_hidden) {
if (display_hidden) { String style = e.attr("style");
String style = e.attr("style"); e.attr("style", mergeStyles(style, "text-decoration:line-through;"));
e.attr("style", mergeStyles(style, "text-decoration:line-through;")); } else {
} else { e.remove();
e.remove(); Log.i("Removed tag=" + tag + " xmlns=" + xmlns);
Log.i("Removed tag=" + tag + " xmlns=" + xmlns); }
} }
} }
} }

Loading…
Cancel
Save