My xml string is:
String neMsg= "<root>"
+" <CONTENT>"
+" <![CDATA[00000:<ResponseClass Name=\"Response\"><ITEM>HAHA</ITEM></ResponseClass>]]>"
+" </CONTENT>"
+"</root>";
I have tried to write the code using four ways, but still can not get the content. How do I solve this problem?
//java.util.regex.Pattern pP0=java.util.regex.Pattern.compile("<!\\[CDATA\\[00000:(\\s|\\S)*?\\]\\]>");
// java.util.regex.Pattern pP0=java.util.regex.Pattern.compile("<!\\[CDATA\\[00000:(.*)\\]\\]>");
// java.util.regex.Pattern pP0=java.util.regex.Pattern.compile("<CONTENT>(.*)<!\\[CDATA\\[(.*)\\]\\]>(.*)</CONTENT>");
Pattern pP0 = Pattern.compile(".*<!\\[CDATA\\[00000:(.*)\\]\\]>.*");
java.util.regex.Matcher mP0= pP0.matcher(neMsg);
System.out.println(mP0.group(1));