[Htmlparser-cvs] htmlparser/src/org/htmlparser/tags StyleTag.java,1.34,1.35
Brought to you by:
derrickoswald
From: <der...@us...> - 2004-02-29 14:34:35
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8741/tags Modified Files: StyleTag.java Log Message: Fix bug #900125 Style Tag Children not grouped Added StyleScanner, a near copy of ScriptScanner. Added testStyleChildren() in StyleTagTest to check it's operation. Index: StyleTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/StyleTag.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** StyleTag.java 2 Jan 2004 16:24:55 -0000 1.34 --- StyleTag.java 29 Feb 2004 14:16:27 -0000 1.35 *************** *** 27,30 **** --- 27,32 ---- package org.htmlparser.tags; + import org.htmlparser.scanners.StyleScanner; + /** * A StyleTag represents a <style> tag. *************** *** 38,45 **** --- 40,53 ---- /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"BODY", "HTML"}; + + /** * Create a new style tag. */ public StyleTag () { + setThisScanner (new StyleScanner ()); } *************** *** 54,79 **** /** * Get the style data in this tag. * @return The HTML of the children of this tag. */ ! public String getStyleCode() { ! return getChildrenHTML(); } /** * Print the contents of the style node. */ public String toString() { ! String guts = toHtml(); ! guts = guts.substring (1, guts.length () - 2); ! StringBuffer sb = new StringBuffer(); ! sb.append("Style Node : \n"); ! sb.append("\n"); ! sb.append("Code\n"); ! sb.append("****\n"); ! sb.append(guts+"\n"); ! return sb.toString(); } } --- 62,100 ---- /** + * Return the set of end tag names that cause this tag to finish. + * @return The names of following end tags that stop further scanning. + */ + public String[] getEndTagEnders () + { + return (mEndTagEnders); + } + + /** * Get the style data in this tag. * @return The HTML of the children of this tag. */ ! public String getStyleCode () { ! return (getChildrenHTML ()); } /** * Print the contents of the style node. + * @return A string suitable for debugging or a printout. */ public String toString() { ! String guts; ! StringBuffer ret; ! ! ret = new StringBuffer (); ! ! guts = toHtml (); ! guts = guts.substring (1, guts.length () - 1); ! ret.append ("Style node :\n"); ! ret.append (guts); ! ret.append ("\n"); ! ! return (ret.toString ()); } } |