You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2005/03/17 00:45:08 UTC
svn commit: r157831 -
lenya/sandbox/jcrsitetree/src/java/org/apache/lenya/cms/publication/JCRSiteTree.java
Author: michi
Date: Wed Mar 16 15:45:05 2005
New Revision: 157831
URL: http://svn.apache.org/viewcvs?view=rev&rev=157831
Log:
resolve prefix of specific namespace
Modified:
lenya/sandbox/jcrsitetree/src/java/org/apache/lenya/cms/publication/JCRSiteTree.java
Modified: lenya/sandbox/jcrsitetree/src/java/org/apache/lenya/cms/publication/JCRSiteTree.java
URL: http://svn.apache.org/viewcvs/lenya/sandbox/jcrsitetree/src/java/org/apache/lenya/cms/publication/JCRSiteTree.java?view=diff&r1=157830&r2=157831
==============================================================================
--- lenya/sandbox/jcrsitetree/src/java/org/apache/lenya/cms/publication/JCRSiteTree.java (original)
+++ lenya/sandbox/jcrsitetree/src/java/org/apache/lenya/cms/publication/JCRSiteTree.java Wed Mar 16 15:45:05 2005
@@ -93,15 +93,32 @@
log.error("Repo: " + repo);
Session session = repo.login(new SimpleCredentials("anonymous", "".toCharArray()), null);
+ String prefix = null;
+
+ String[] prefixes = session.getNamespacePrefixes();
+ for (int i = 0; i < prefixes.length; i++) {
+ String namespace = session.getNamespaceURI(prefixes[i]);
+ if (namespace.equals(NAMESPACE_URI)) {
+ prefix = prefixes[i];
+ break;
+ }
+ }
+
+ if (prefix == null) {
+ throw new Exception("No prefix for namespace: " + NAMESPACE_URI);
+ }
+
org.apache.cocoon.xml.dom.DOMBuilder domBuilder = new org.apache.cocoon.xml.dom.DOMBuilder();
- session.exportDocView("/" + area + "/_pre10:site", domBuilder, true, false);
+ // NOTE: XPath cannot be used
+ //session.exportDocView("/" + area + "/*[local-name() = 'site' and namespace-uri() = '"+NAMESPACE_URI+"']", domBuilder, true, false);
+ session.exportDocView("/" + area + "/" + prefix + ":site", domBuilder, true, false);
document = domBuilder.getDocument();
log.error("Root Element Name: " + document.getDocumentElement().getTagName());
// For Debugging
/*
java.io.FileOutputStream out = new java.io.FileOutputStream("/home/michi/repo.jcr");
- session.exportDocView("/" + area + "/_pre10:site", out, true, false);
+ session.exportDocView("/" + area + "/" + prefix + ":site", out, true, false);
out.close();
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org