6868import javax .xml .xpath .XPathConstants ;
6969import javax .xml .xpath .XPathExpressionException ;
7070import javax .xml .xpath .XPathFactory ;
71+ import net .sf .saxon .trans .SymbolicName ;
7172import net .sf .saxon .xpath .XPathFactoryImpl ;
7273import org .w3c .dom .Document ;
7374import org .w3c .dom .Node ;
@@ -126,7 +127,7 @@ public final class XMLDocument implements XML {
126127 */
127128 public XMLDocument (final String text ) {
128129 this (
129- new DomParser (XMLDocument . configuredDFactory () , text ).document (),
130+ new DomParser (FACTORY , text ).document (),
130131 new XPathContext (),
131132 false
132133 );
@@ -152,7 +153,7 @@ public XMLDocument(final String text) {
152153 */
153154 public XMLDocument (final byte [] data ) {
154155 this (
155- new DomParser (XMLDocument . configuredDFactory () , data ).document (),
156+ new DomParser (FACTORY , data ).document (),
156157 new XPathContext (),
157158 false
158159 );
@@ -202,8 +203,8 @@ public XMLDocument(final Source source) {
202203 * @throws FileNotFoundException In case of I/O problems
203204 */
204205 public XMLDocument (final File file ) throws FileNotFoundException {
205- this (new TextResource (file ).toString ());
206- // this(new DomParser(XMLDocument.configuredDFactory() , file).document());
206+ // this(new TextResource(file).toString());
207+ this (new DomParser (FACTORY , file ).document ());
207208 }
208209
209210 /**
@@ -322,7 +323,8 @@ public Node node() {
322323 final Node casted = this .cache ;
323324 final Node answer ;
324325 if (casted instanceof Document ) {
325- answer = casted .cloneNode (true );
326+ answer = casted ;
327+ // answer = casted.cloneNode(true);
326328 } else {
327329 answer = XMLDocument .createImportedNode (casted );
328330 }
@@ -478,7 +480,7 @@ public Collection<SAXParseException> validate(final Schema schema) {
478480 * @return A cloned node imported in a dedicated document.
479481 */
480482 private static Node createImportedNode (final Node node ) {
481- final DocumentBuilderFactory factory = XMLDocument . configuredDFactory () ;
483+ final DocumentBuilderFactory factory = FACTORY ;
482484 final DocumentBuilder builder ;
483485 try {
484486 builder = factory .newDocumentBuilder ();
@@ -599,6 +601,8 @@ private static Node transform(final Source source) {
599601 return result .getNode ();
600602 }
601603
604+ private static final DocumentBuilderFactory FACTORY = XMLDocument .configuredDFactory ();
605+
602606 /**
603607 * Create new {@link DocumentBuilderFactory} and configure it.
604608 * @return Configured factory
0 commit comments