Using Abdera XPath on the Lotus Connections service document

As always namespaces and XPath/XSLT is “funny” to play around with. Tonight I have been messing a little with the ATOM feeds available in Lotus Connections and needed to use XPath to extract a URL from the service document instead of the object model in Abdera. I didn’t find it all together easy to figure out so I’ll post it here in case it helps anyone. The key is to specify a java.util.Map with the two namespaces in use (atom, app) when doing the XPath (the “ns” variable) and remembering to use the correct namespaces in the actual XPath string.

Document<Service> doc = ...;
XPath x = Abdera.getNewXPath();
Map ns = new HashMap();
ns.put("atom", "");
ns.put("app", "");

String link = x.valueOf("/app:service/app:workspace" +
   "/atom:link[@rel='" +
   "/mv/theboard']/@href", service, ns));
System.out.println("Link: " + link);

One thought on “Using Abdera XPath on the Lotus Connections service document”

  1. Thanks!

    Great tip, for newbies to XPath, Adbdera and Connections (like my self) from the code above the only missing bit is

    Service s = doc.getRoot();

    Right after you instantiate doc


Comments are closed.