X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Facr%2Fxml%2FDomContentProvider.java;h=66ff878d5c6a9a644445a97bafa64869e19e2cfd;hb=b74e4d3911480252ab20de7cacffdba695c78920;hp=d6e246df53fb9282c9171cc8e2fd977b12a07b4b;hpb=f3ea14abccc33b1c3326417a87c91145be776c72;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java b/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java index d6e246df5..66ff878d5 100644 --- a/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java +++ b/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java @@ -8,6 +8,7 @@ import java.util.Iterator; import java.util.List; import javax.xml.namespace.NamespaceContext; +import javax.xml.transform.TransformerFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; @@ -32,12 +33,17 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { // TODO centralise in some executor? private final ThreadLocal xPath; + private TransformerFactory transformerFactory; + private String mountPath; public DomContentProvider(String mountPath, Document document) { this.mountPath = mountPath; this.document = document; this.document.normalizeDocument(); + + transformerFactory = TransformerFactory.newInstance(); + XPathFactory xPathFactory = XPathFactory.newInstance(); xPath = new ThreadLocal<>() { @@ -70,7 +76,8 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { if (nodes.getLength() > 1) throw new IllegalArgumentException("Multiple content found for " + relativePath + " under " + mountPath); if (nodes.getLength() == 0) - throw new ContentNotFoundException("Path " + relativePath + " under " + mountPath + " was not found"); + throw new ContentNotFoundException(session, mountPath + "/" + relativePath, + "Path " + relativePath + " under " + mountPath + " was not found"); Element element = (Element) nodes.item(0); return new DomContent(session, this, element); } @@ -145,4 +152,8 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { return Collections.unmodifiableList(res).iterator(); } + TransformerFactory getTransformerFactory() { + return transformerFactory; + } + }