import org.argeo.api.acr.spi.ProvidedContent;
import org.argeo.api.acr.spi.ProvidedSession;
import org.argeo.cms.acr.CmsContentRepository;
-import org.argeo.cms.acr.ContentUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
protected NodeList findContent(String relativePath) {
if (relativePath.startsWith("/"))
throw new IllegalArgumentException("Relative path cannot start with /");
- String xPathExpression = '/' + relativePath;
- if (ContentUtils.SLASH_STRING.equals(mountPath)) // repository root
- xPathExpression = "/" + CrName.root.qName() + 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;
return nodes.getLength() != 0;
}
+ @Override
public void persist(ProvidedSession session) {
if (mountPath != null) {
Content mountPoint = session.getMountPoint(mountPath);