How to acces the string inside XML cdata in android -
i trying make android app reads online xml file. xml file includes cdata. , need text inside cdata. how this? in advance!
<id> <![cdata[ 10217 ]]> </id>
public static string getcharacterdatafromelement(element e) { nodelist list = e.getchildnodes(); string data; for(int index = 0; index < list.getlength(); index++){ if(list.item(index) instanceof characterdata){ characterdata child = (characterdata) list.item(index); data = child.getdata(); if(data != null && data.trim().length() > 0) return child.getdata(); } } return ""; }
Comments
Post a Comment