Extract value from CDATA

I am using java (JAXB) and I want to get data from CDATA

<![CDATA[Need Help]]> 

Desired Conclusion

 Need Help 

Can any body help me. I tried several solutions.

Thanks!!

+2
source share
1 answer

try it

 @XmlAccessorType(XmlAccessType.FIELD) public class Test0 { String e1; public static void main(String[] args) throws Exception { String xml = "<root><e1><![CDATA[Need Help]]></e1></root>"; Test0 t = JAXB.unmarshal(new StringReader(xml), Test0.class); System.out.println(t.e1); } } 

Exit

 Need Help 
+2
source

All Articles