-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
It seems BasicTransformer has exponential complexity on the nesting level of the XML being processed. This is due to this method:
def transform(ns: Seq[Node]): Seq[Node] = {
val (xs1, xs2) = ns span (n => unchanged(n, transform(n)))
if (xs2.isEmpty) ns
else xs1 ++ transform(xs2.head) ++ transform(xs2.tail)
}Each modified node is transformed twice: once at the span, and again at the if/else. So, for <a><b><c><d/></c></b></a>, with c being modified, node a gets transformed twice, node b gets transformed four times (twice for each time a is transformed), and node c gets transformed eight times.