Java tutorial
//package com.java2s; public class Main { private static String getNodeText(String name, String str) { String b = "<" + name + ">"; return str.substring(str.indexOf(b) + b.length(), str.indexOf("</" + getName(name) + ">")).trim(); } private static String getName(String str) { int space = str.indexOf(' '); if (space > 0) return str.substring(0, space); else return str; } }