Merge tag 'v2.3.28' into testing
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / acr / xml / DomContentProvider.java
index 845a6ab4c22a23629194b6bab0e3a0609d8ed2d9..20f7eb1534cbb79fb21bd17e0fe93585e17bb706 100644 (file)
@@ -75,9 +75,13 @@ public class DomContentProvider implements ContentProvider, NamespaceContext {
        protected NodeList findContent(String relativePath) {
                if (relativePath.startsWith("/"))
                        throw new IllegalArgumentException("Relative path cannot start with /");
-               String xPathExpression = '/' + relativePath;
-               if (Content.ROOT_PATH.equals(mountPath)) // repository root
-                       xPathExpression = "/" + CrName.root.get() + xPathExpression;
+               String xPathExpression;
+               if (Content.ROOT_PATH.equals(mountPath)) {// repository root
+                       xPathExpression = "/" + CrName.root.get() + '/' + relativePath;
+               } else {
+                       String documentNodeName = document.getDocumentElement().getNodeName();
+                       xPathExpression = '/' + documentNodeName + '/' + relativePath;
+               }
                try {
                        NodeList nodes = (NodeList) xPath.get().evaluate(xPathExpression, document, XPathConstants.NODESET);
                        return nodes;