+ /**
+ * Get the XML text of this node.
+ */
+ public static String getXmlValue(Node node) {
+ try {
+ if (!node.hasNode(Jcr.JCR_XMLTEXT))
+ return null;
+ Node xmlText = node.getNode(Jcr.JCR_XMLTEXT);
+ if (!xmlText.hasProperty(Jcr.JCR_XMLCHARACTERS))
+ throw new IllegalArgumentException(
+ "Node " + xmlText + " has no " + Jcr.JCR_XMLCHARACTERS + " property");
+ return xmlText.getProperty(Jcr.JCR_XMLCHARACTERS).getString();
+ } catch (RepositoryException e) {
+ throw new IllegalStateException("Cannot get " + node + " as XML text", e);
+ }
+ }
+