jOOQ / jOOX

jOOX - The Power of jQuery Applied to W3C DOM Like JDBC, DOM is a powerful, yet very verbose low-level API to manipulate XML. The HTML DOM an be manipulated with the popular jQuery product, in JavaScript. Why don't we have jQuery in Java? jOOX is jQuery's XML parts, applied to Java.

Home Page:http://www.jooq.org/products

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inefficient internal content(Element) method

lukaseder opened this issue · comments

There's an internal content(Element) method with a TODO that does not yet have an issue associated with it:

// TODO: Check this code's efficiency
String name = element.getTagName();
return Util.toString(element).replaceAll("(?s)^<" + name + "(?:[^>]*)>(.*)</" + name + ">$", "$1");

This is very obviously inefficient. We cannot cache the regular expression, but we can traverse the string without resorting to regexes, as the regex logic is rather simple.