/** * Returns the text contained inside this link tag. * @return The textual contents between the {@.html <A></A>} pair. */ public String getLinkText() { String ret; if (null != getChildren ()) ret = getChildren ().asString (); else ret = ""; return (ret); }
/** * Returns the text contained inside this link tag. * @return The textual contents between the {@.html <A></A>} pair. */ public String getLinkText() { String ret; if (null != getChildren ()) ret = getChildren ().asString (); else ret = ""; return (ret); }
import org.htmlparser.Parser; import org.htmlparser.util.NodeList; import org.htmlparser.util.ParserException; ... String html; /* read your HTML into variable 'html' */ String result=null; .... try { Parser p = new Parser(html); NodeList nodes = p.parse(null); result = nodes.asString(); } catch (ParserException e) { e.printStackTrace(); }