diff --git a/src/main/java/org/dita/index/IndexPreprocessor.java b/src/main/java/org/dita/index/IndexPreprocessor.java index 36f4bb8..ecdaad4 100644 --- a/src/main/java/org/dita/index/IndexPreprocessor.java +++ b/src/main/java/org/dita/index/IndexPreprocessor.java @@ -35,7 +35,6 @@ RELIANCE, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO LOSS OF import static org.dita.dost.util.Constants.*; import java.util.*; -import javax.xml.parsers.DocumentBuilder; import org.dita.dost.log.DITAOTLogger; import org.dita.dost.util.XMLUtils; import org.dita.index.configuration.IndexConfiguration; @@ -101,8 +100,7 @@ public void setLogger(final DITAOTLogger logger) { * @return read index terms */ IndexPreprocessResult process(final Document input) { - final DocumentBuilder documentBuilder = XMLUtils.getDocumentBuilder(); - final Document doc = documentBuilder.newDocument(); + final Document doc = input.getImplementation().createDocument(null, null, null); final Node rootElement = input.getDocumentElement(); final List indexes = new ArrayList<>(); final Node node = processCurrNode(rootElement, doc, indexes::add).get(0); diff --git a/src/main/java/org/dita/index/IndexPreprocessorTask.java b/src/main/java/org/dita/index/IndexPreprocessorTask.java index d834dd7..90f6e4f 100644 --- a/src/main/java/org/dita/index/IndexPreprocessorTask.java +++ b/src/main/java/org/dita/index/IndexPreprocessorTask.java @@ -38,6 +38,8 @@ RELIANCE, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO LOSS OF import java.util.Collection; import java.util.Locale; import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; @@ -47,7 +49,6 @@ RELIANCE, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO LOSS OF import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.dita.dost.log.DITAOTAntLogger; -import org.dita.dost.util.XMLUtils; import org.dita.index.configuration.IndexConfiguration; import org.dita.index.configuration.ParseException; import org.w3c.dom.Document; @@ -71,12 +72,13 @@ public class IndexPreprocessorTask extends Task { public void execute() throws BuildException { checkParameters(); - final DocumentBuilder documentBuilder = XMLUtils.getDocumentBuilder(); - final Document doc; try { + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + final DocumentBuilder documentBuilder = factory.newDocumentBuilder(); doc = documentBuilder.parse(input); - } catch (SAXException | IOException e) { + } catch (SAXException | IOException | ParserConfigurationException e) { throw new BuildException(e); }