Changeset 24972 for main/trunk


Ignore:
Timestamp:
2012-01-25T12:29:26+13:00 (12 years ago)
Author:
sjm84
Message:

Added a function that escapes quotes and a function that escapes both new lines and quotes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r24928 r24972  
    424424        return str.replace("\n", "\\\n");
    425425    }
     426   
     427    public static String escapeQuotes(String str)
     428    {
     429        if(str == null || str.length() < 1)
     430        {
     431            return null;
     432        }
     433        return str.replace("\"", "\\\"");
     434    }
     435   
     436    public static String escapeNewLinesAndQuotes(String str)
     437    {
     438        if(str == null || str.length() < 1)
     439        {
     440            return null;
     441        }
     442        return escapeNewLines(escapeQuotes(str));
     443    }
    426444}
Note: See TracChangeset for help on using the changeset viewer.