diff --git a/pom.xml b/pom.xml
index 2ffc8adc..3ceb87ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -250,50 +250,5 @@
-
- coveralls
-
- pom.xml
-
-
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
-
-
- site
-
- cobertura
-
-
- xml
- 256m
-
-
-
-
-
- org.eluder.coveralls
- coveralls-maven-plugin
- 4.1.0
-
-
- site
-
- report
-
-
- ${coveralls.token}
-
- ${project.build.directory}/generated-sources/antlr3
-
-
-
-
-
-
-
-
diff --git a/src/main/java/org/xembly/XpathDirective.java b/src/main/java/org/xembly/XpathDirective.java
index 3caec5b0..d6a654a8 100644
--- a/src/main/java/org/xembly/XpathDirective.java
+++ b/src/main/java/org/xembly/XpathDirective.java
@@ -58,7 +58,13 @@ final class XpathDirective implements Directive {
/**
* XPath factory.
*/
- private static final XPathFactory FACTORY = XPathFactory.newInstance();
+ private static final ThreadLocal FACTORY =
+ new ThreadLocal() {
+ @Override
+ protected XPathFactory initialValue() {
+ return XPathFactory.newInstance();
+ }
+ };
/**
* Pattern to match root-only XPath queries.
@@ -135,7 +141,7 @@ private static Collection rootOnly(final String root,
private static Collection traditional(final String query,
final Node dom, final Collection current)
throws ImpossibleModificationException {
- final XPath xpath = XpathDirective.FACTORY.newXPath();
+ final XPath xpath = XpathDirective.FACTORY.get().newXPath();
final Collection targets = new HashSet(0);
for (final Node node : XpathDirective.roots(dom, current)) {
final NodeList list;