Java tutorial
//package com.java2s; public class Main { /** * Extract element. * * @param xml * the xml * @param name * the name * @return the string */ public static String extractElement(final String xml, final String name) { if (xml.indexOf("<" + name) > 0) { return xml.substring(xml.indexOf("<" + name), xml.indexOf("</" + name + ">") + name.length() + 3); } return ""; } }