Here you can find the source of unwrapCdata(String sText)
Parameter | Description |
---|---|
sText | The text containing a CDATA wrapper. |
public static String unwrapCdata(String sText)
//package com.java2s; public class Main { /**/*from w ww. ja v a 2 s . c o m*/ * If the text is wrapped with a "[CDATA[ ]]" tag then it is removed and the text inside is returned. * * @param sText The text containing a CDATA wrapper. * @return The text without the CDATA wrapper. If it does not contain a CDATA wrapper, it simply returns the same * text it was passed. */ public static String unwrapCdata(String sText) { if ((sText != null) && (sText.trim().startsWith("[CDATA[")) && (sText.trim().endsWith("]]"))) { return sText.trim().substring(7, sText.trim().length() - 2); } else { return sText; } } }