protected String escapeApostrophes ( String text ) { String resultString ; if ( text . contains ( "'" ) ) { StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( "concat('" ) ; stringBuilder . append ( text . replace ( "'" , "',\"'\",'" ) ) ; stringBuilder . append ( "')" ) ; resultString = stringBuilder . toString ( ) ; } else { resultString = "'" + text + "'" ; } return resultString ; }
Returns a string to resolve apostrophe issue in xpath