net.sourceforge.openutils.mgnlcriteria.jcr.query.xpath.utils
Class XPathTextUtils

java.lang.Object
  extended by net.sourceforge.openutils.mgnlcriteria.jcr.query.xpath.utils.XPathTextUtils

public final class XPathTextUtils
extends Object

A utility class to escape xpath strings

Version:
$Id: XPathTextUtils.java 2933 2010-08-29 16:00:21Z fgiust $
Author:
fgiust, fgrilli

Method Summary
static String encodeDigitsInPath(String path)
           
static String stringToJCRSearchExp(String str)
          Convert a string to a JCR search expression literal, suitable for use in jcr:contains() (inside XPath queries).
static String stringToXPathLiteral(String str)
          Convert a string to an XPath 2.0 string literal, suitable for inclusion in a query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stringToXPathLiteral

public static String stringToXPathLiteral(String str)
Convert a string to an XPath 2.0 string literal, suitable for inclusion in a query. See JSR-170 spec v1.0, Sec. 6.6.4.9.

Parameters:
str - Any string.
Returns:
A valid XPath 2.0 string literal, including enclosing quotes.

stringToJCRSearchExp

public static String stringToJCRSearchExp(String str)
Convert a string to a JCR search expression literal, suitable for use in jcr:contains() (inside XPath queries). The characters - and " have special meaning, and may be escaped with a backslash to obtain their literal value. See JSR-170 spec v1.0, Sec. 6.6.5.2.

Parameters:
str - Any string.
Returns:
A valid XPath 2.0 string literal suitable for use in jcr:contains(), including enclosing quotes.

encodeDigitsInPath

public static String encodeDigitsInPath(String path)
Parameters:
path - to encode eg //my//path/2009//*
Returns:
String encoded path eg //my//path/_x0032_009//*


Copyright © 2009-2010 Openmind. All Rights Reserved.