get Node Value With Attribute
class Main {
public static String getNodeValueWithAttribute(String XML, String nodeName,
String attribute) {
String tokenValue = null;
int start = XML.indexOf("<" + nodeName + " " + attribute + ">")
+ ("<" + nodeName + " " + attribute + ">").length();
int stop = XML.indexOf("</" + nodeName + ">");
try {
tokenValue = XML.substring(start, stop);
} catch (Exception ex) {
}
return tokenValue;
}
}
Related examples in the same category