[Htmlparser-cvs] htmlparser/src/org/htmlparser/tags AppletTag.java,1.34,1.35 BaseHrefTag.java,1.30,1
Brought to you by:
derrickoswald
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1:/tmp/cvs-serv6198/tags Modified Files: AppletTag.java BaseHrefTag.java BodyTag.java Bullet.java BulletList.java CompositeTag.java Div.java DoctypeTag.java FormTag.java FrameSetTag.java FrameTag.java HeadTag.java Html.java ImageTag.java InputTag.java JspTag.java LabelTag.java LinkTag.java MetaTag.java OptionTag.java ScriptTag.java SelectTag.java Span.java StyleTag.java TableColumn.java TableRow.java TableTag.java Tag.java TextareaTag.java TitleTag.java Log Message: The tags now own their ids, enders and end tag enders. The isTagToBeEndedFor logic is now uses information from the tags, not the scanners. The kludge to get the scanner from the NodeFactory is now gone too, this also comes from the tag. Index: AppletTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/AppletTag.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** AppletTag.java 26 Oct 2003 19:46:21 -0000 1.34 --- AppletTag.java 6 Nov 2003 03:00:27 -0000 1.35 *************** *** 46,52 **** public class AppletTag extends CompositeTag { public AppletTag () { ! setTagName ("APPLET"); } --- 46,82 ---- public class AppletTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"APPLET"}; + + /** + * 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 applet tag. + */ public AppletTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * 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); } Index: BaseHrefTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/BaseHrefTag.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** BaseHrefTag.java 1 Nov 2003 21:55:43 -0000 1.30 --- BaseHrefTag.java 6 Nov 2003 03:00:27 -0000 1.31 *************** *** 30,34 **** package org.htmlparser.tags; - import java.util.Vector; import org.htmlparser.lexer.Page; import org.htmlparser.util.LinkProcessor; --- 30,33 ---- *************** *** 40,46 **** public class BaseHrefTag extends Tag { public BaseHrefTag () { ! setTagName ("BASE"); } --- 39,61 ---- public class BaseHrefTag extends Tag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"BASE"}; + + /** + * Create a new base tag. + */ public BaseHrefTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: BodyTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/BodyTag.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** BodyTag.java 26 Oct 2003 19:46:23 -0000 1.17 --- BodyTag.java 6 Nov 2003 03:00:28 -0000 1.18 *************** *** 35,41 **** public class BodyTag extends CompositeTag { public BodyTag () { ! setTagName ("BODY"); } --- 35,80 ---- public class BodyTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"BODY"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"HTML"}; + + /** + * Create a new body tag. + */ public BodyTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mIds); ! } ! ! /** ! * 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); } Index: Bullet.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Bullet.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Bullet.java 26 Oct 2003 19:46:23 -0000 1.17 --- Bullet.java 6 Nov 2003 03:00:28 -0000 1.18 *************** *** 32,40 **** * A bullet tag. */ ! public class Bullet extends CompositeTag { public Bullet () { ! setTagName ("LI"); } } --- 32,79 ---- * A bullet tag. */ ! public class Bullet extends CompositeTag ! { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"LI"}; ! ! /** ! * The set of end tag names that indicate the end of this tag. ! */ ! private static final String[] mEndTagEnders = new String[] {"UL", "OL", "BODY", "HTML"}; + /** + * Create a new bullet tag. + */ public Bullet () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mIds); ! } ! ! /** ! * 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); } } Index: BulletList.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/BulletList.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** BulletList.java 26 Oct 2003 19:46:23 -0000 1.17 --- BulletList.java 6 Nov 2003 03:00:28 -0000 1.18 *************** *** 33,41 **** * Either <UL> or <OL>. */ ! public class BulletList extends CompositeTag { public BulletList () { ! setTagName ("UL"); // could be "OL" too } } --- 33,71 ---- * Either <UL> or <OL>. */ ! public class BulletList extends CompositeTag ! { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"UL", "OL"}; + /** + * 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 bullet list (ordered or unordered) tag. + */ public BulletList () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * 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); } } Index: CompositeTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/CompositeTag.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** CompositeTag.java 4 Nov 2003 01:25:02 -0000 1.63 --- CompositeTag.java 6 Nov 2003 03:00:28 -0000 1.64 *************** *** 29,37 **** package org.htmlparser.tags; ! import java.util.Vector; ! import org.htmlparser.*; import org.htmlparser.AbstractNode; - import org.htmlparser.lexer.Page; import org.htmlparser.lexer.nodes.TagNode; import org.htmlparser.util.NodeList; import org.htmlparser.util.SimpleNodeIterator; --- 29,37 ---- package org.htmlparser.tags; ! import org.htmlparser.Node; ! import org.htmlparser.StringNode; import org.htmlparser.AbstractNode; import org.htmlparser.lexer.nodes.TagNode; + import org.htmlparser.scanners.CompositeTagScanner; import org.htmlparser.util.NodeList; import org.htmlparser.util.SimpleNodeIterator; *************** *** 44,52 **** * the {@link #toHtml toHtml} method. */ ! public abstract class CompositeTag extends Tag { protected TagNode mEndTag; public CompositeTag () { } --- 44,63 ---- * the {@link #toHtml toHtml} method. */ ! public class CompositeTag extends Tag ! { ! /** ! * The tag that causes this tag to finish. ! * May be a virtual tag generated by the scanning logic. ! */ protected TagNode mEndTag; + /** + * The default scanner for non-composite tags. + */ + protected final static CompositeTagScanner mDefaultScanner = new CompositeTagScanner (); + public CompositeTag () { + setThisScanner (mDefaultScanner); } Index: Div.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Div.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Div.java 26 Oct 2003 19:46:23 -0000 1.17 --- Div.java 6 Nov 2003 03:00:28 -0000 1.18 *************** *** 34,40 **** public class Div extends CompositeTag { public Div () { ! setTagName ("DIV"); } } --- 34,70 ---- public class Div extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"DIV"}; + + /** + * 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 div tag. + */ public Div () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * 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); } } Index: DoctypeTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/DoctypeTag.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** DoctypeTag.java 1 Nov 2003 01:36:57 -0000 1.32 --- DoctypeTag.java 6 Nov 2003 03:00:28 -0000 1.33 *************** *** 35,41 **** public class DoctypeTag extends Tag { public DoctypeTag () { ! setTagName ("!DOCTYPE"); } --- 35,57 ---- public class DoctypeTag extends Tag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"!DOCTYPE"}; + + /** + * Create a new !doctype tag. + */ public DoctypeTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: FormTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FormTag.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** FormTag.java 1 Nov 2003 21:55:43 -0000 1.39 --- FormTag.java 6 Nov 2003 03:00:28 -0000 1.40 *************** *** 48,55 **** protected String mFormLocation; public FormTag () { - setTagName ("FORM"); mFormLocation = null; } --- 48,94 ---- protected String mFormLocation; + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"FORM"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"HTML", "BODY"}; + + /** + * Create a new form tag. + */ public FormTag () { mFormLocation = null; + } + + /** + * Return the set of names handled by this tag. + * @return The names to be matched that create tags of this type. + */ + public String[] getIds () + { + return (mIds); + } + + /** + * Return the set of tag names that cause this tag to finish. + * @return The names of following tags that stop further scanning. + */ + public String[] getEnders () + { + return (mIds); + } + + /** + * 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); } Index: FrameSetTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FrameSetTag.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** FrameSetTag.java 1 Nov 2003 01:36:57 -0000 1.30 --- FrameSetTag.java 6 Nov 2003 03:00:28 -0000 1.31 *************** *** 38,44 **** public class FrameSetTag extends CompositeTag { public FrameSetTag () { ! setTagName ("FRAMESET"); } --- 38,74 ---- public class FrameSetTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"FRAMESET"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"HTML"}; + + /** + * Create a new frame set tag. + */ public FrameSetTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * 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); } Index: FrameTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FrameTag.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** FrameTag.java 1 Nov 2003 01:36:57 -0000 1.29 --- FrameTag.java 6 Nov 2003 03:00:28 -0000 1.30 *************** *** 36,42 **** public class FrameTag extends Tag { public FrameTag () { ! setTagName ("FRAME"); } --- 36,58 ---- public class FrameTag extends Tag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"FRAME"}; + + /** + * Create a new frame tag. + */ public FrameTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: HeadTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/HeadTag.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** HeadTag.java 26 Oct 2003 19:46:24 -0000 1.17 --- HeadTag.java 6 Nov 2003 03:00:28 -0000 1.18 *************** *** 37,44 **** public class HeadTag extends CompositeTag { public HeadTag () { ! setTagName ("HEAD"); } --- 37,87 ---- public class HeadTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"HEAD"}; + + /** + * The set of tag names that indicate the end of this tag. + */ + private static final String[] mEnders = new String[] {"HEAD", "BODY"}; + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"HTML"}; + + /** + * Create a new head tag. + */ public HeadTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mEnders); ! } ! ! /** ! * 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); } Index: Html.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Html.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Html.java 26 Oct 2003 19:46:24 -0000 1.29 --- Html.java 6 Nov 2003 03:00:28 -0000 1.30 *************** *** 34,41 **** public class Html extends CompositeTag { public Html () { ! setTagName ("HTML"); } } --- 34,56 ---- public class Html extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"HTML"}; + /** + * Create a new html tag. + */ public Html () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } } Index: ImageTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/ImageTag.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ImageTag.java 1 Nov 2003 21:55:43 -0000 1.34 --- ImageTag.java 6 Nov 2003 03:00:28 -0000 1.35 *************** *** 44,47 **** --- 44,52 ---- /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"IMG"}; + + /** * Holds the set value of the SRC attribute, since this can differ * from the attribute value due to relative references resolved by *************** *** 50,57 **** protected String imageURL; public ImageTag () { - setTagName ("IMG"); imageURL = null; } --- 55,73 ---- protected String imageURL; + /** + * Create a new image tag. + */ public ImageTag () { imageURL = null; + } + + /** + * Return the set of names handled by this tag. + * @return The names to be matched that create tags of this type. + */ + public String[] getIds () + { + return (mIds); } Index: InputTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/InputTag.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** InputTag.java 26 Oct 2003 19:46:24 -0000 1.29 --- InputTag.java 6 Nov 2003 03:00:28 -0000 1.30 *************** *** 36,42 **** public class InputTag extends Tag { public InputTag () { ! setTagName ("INPUT"); } --- 36,58 ---- public class InputTag extends Tag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"INPUT"}; + + /** + * Create a new input tag. + */ public InputTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: JspTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/JspTag.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** JspTag.java 1 Nov 2003 01:36:57 -0000 1.34 --- JspTag.java 6 Nov 2003 03:00:28 -0000 1.35 *************** *** 37,43 **** public class JspTag extends Tag { public JspTag () { ! setTagName ("%"); } --- 37,59 ---- public class JspTag extends Tag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"%", "%=", "%@"}; + + /** + * Create a new jsp tag. + */ public JspTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: LabelTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/LabelTag.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** LabelTag.java 26 Oct 2003 19:46:24 -0000 1.30 --- LabelTag.java 6 Nov 2003 03:00:28 -0000 1.31 *************** *** 37,43 **** public class LabelTag extends CompositeTag { public LabelTag () { ! setTagName ("LABEL"); } --- 37,68 ---- public class LabelTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"LABEL"}; + + /** + * Create a new lavel tag. + */ public LabelTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mIds); } Index: LinkTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/LinkTag.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** LinkTag.java 1 Nov 2003 21:55:43 -0000 1.41 --- LinkTag.java 6 Nov 2003 03:00:29 -0000 1.42 *************** *** 42,45 **** --- 42,61 ---- { public static final String LINK_TAG_FILTER="-l"; + + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"A"}; + + /** + * The set of tag names that indicate the end of this tag. + */ + private static final String[] mEnders = new String[] {"A", "TD", "TR", "FORM", "LI"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"TD", "TR", "FORM", "LI", "BODY", "HTML"}; + /** * The URL where the link points to *************** *** 58,62 **** /** ! * Constructor creates an LinkNode object, which basically stores the location * where the link points to, and the text it contains. * <p> --- 74,78 ---- /** ! * Constructor creates an LinkTag object, which basically stores the location * where the link points to, and the text it contains. * <p> *************** *** 91,95 **** public LinkTag () { ! setTagName ("A"); } --- 107,137 ---- public LinkTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mEnders); ! } ! ! /** ! * 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); } Index: MetaTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/MetaTag.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** MetaTag.java 26 Oct 2003 19:46:24 -0000 1.29 --- MetaTag.java 6 Nov 2003 03:00:29 -0000 1.30 *************** *** 36,43 **** public class MetaTag extends Tag { ! public MetaTag () { ! setTagName ("META"); } --- 36,58 ---- public class MetaTag extends Tag { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"META"}; ! ! /** ! * Create a new meta tag. ! */ public MetaTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: OptionTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/OptionTag.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** OptionTag.java 26 Oct 2003 19:46:24 -0000 1.32 --- OptionTag.java 6 Nov 2003 03:00:30 -0000 1.33 *************** *** 34,40 **** public class OptionTag extends CompositeTag { public OptionTag () { ! setTagName ("OPTION"); } --- 34,84 ---- public class OptionTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"OPTION"}; + + /** + * The set of tag names that indicate the end of this tag. + */ + private static final String[] mEnders = new String[] {"INPUT", "TEXTAREA", "SELECT", "OPTION"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"SELECT", "FORM", "BODY", "HTML"}; + + /** + * Create a new option tag. + */ public OptionTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mEnders); ! } ! ! /** ! * 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); } Index: ScriptTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/ScriptTag.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ScriptTag.java 26 Oct 2003 19:46:24 -0000 1.30 --- ScriptTag.java 6 Nov 2003 03:00:31 -0000 1.31 *************** *** 34,40 **** public class ScriptTag extends CompositeTag { public ScriptTag () { ! setTagName ("SCRIPT"); } --- 34,70 ---- public class ScriptTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"SCRIPT"}; + + /** + * 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 script tag. + */ public ScriptTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * 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); } Index: SelectTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/SelectTag.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** SelectTag.java 26 Oct 2003 19:46:24 -0000 1.31 --- SelectTag.java 6 Nov 2003 03:00:31 -0000 1.32 *************** *** 39,45 **** public class SelectTag extends CompositeTag { public SelectTag () { ! setTagName ("SELECT"); } --- 39,89 ---- public class SelectTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"SELECT"}; + + /** + * The set of tag names that indicate the end of this tag. + */ + private static final String[] mEnders = new String[] {"INPUT", "TEXTAREA", "SELECT"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"FORM", "BODY", "HTML"}; + + /** + * Create a new select tag. + */ public SelectTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mEnders); ! } ! ! /** ! * 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); } Index: Span.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Span.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Span.java 26 Oct 2003 19:46:24 -0000 1.31 --- Span.java 6 Nov 2003 03:00:31 -0000 1.32 *************** *** 32,40 **** * A span tag. */ ! public class Span extends CompositeTag { public Span () { ! setTagName ("SPAN"); } } --- 32,56 ---- * A span tag. */ ! public class Span extends CompositeTag ! { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"SPAN"}; + /** + * Create a new span tag. + */ public Span () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } } Index: StyleTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/StyleTag.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** StyleTag.java 26 Oct 2003 19:46:24 -0000 1.30 --- StyleTag.java 6 Nov 2003 03:00:32 -0000 1.31 *************** *** 32,40 **** * A StyleTag represents a <style> tag. */ ! public class StyleTag extends CompositeTag { ! public StyleTag () { ! setTagName ("STYLE"); } --- 32,56 ---- * A StyleTag represents a <style> tag. */ ! public class StyleTag extends CompositeTag ! { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"STYLE"}; ! ! /** ! * Create a new style tag. ! */ public StyleTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); } Index: TableColumn.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/TableColumn.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** TableColumn.java 26 Oct 2003 19:46:24 -0000 1.31 --- TableColumn.java 6 Nov 2003 03:00:33 -0000 1.32 *************** *** 32,40 **** * A table column tag. */ ! public class TableColumn extends CompositeTag { public TableColumn () { ! setTagName ("TD"); } } --- 32,65 ---- * A table column tag. */ ! public class TableColumn extends CompositeTag ! { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"TD"}; + /** + * Create a new table column tag. + */ public TableColumn () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mIds); } } Index: TableRow.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/TableRow.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** TableRow.java 26 Oct 2003 19:46:24 -0000 1.33 --- TableRow.java 6 Nov 2003 03:00:34 -0000 1.34 *************** *** 34,42 **** * A table row tag. */ ! public class TableRow extends CompositeTag { ! public TableRow () { ! setTagName ("TR"); } --- 34,67 ---- * A table row tag. */ ! public class TableRow extends CompositeTag ! { ! /** ! * The set of names handled by this tag. ! */ ! private static final String[] mIds = new String[] {"TR"}; ! ! /** ! * Create a new table row tag. ! */ public TableRow () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mIds); } Index: TableTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/TableTag.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** TableTag.java 26 Oct 2003 19:46:24 -0000 1.34 --- TableTag.java 6 Nov 2003 03:00:34 -0000 1.35 *************** *** 34,41 **** public class TableTag extends CompositeTag { public TableTag () { ! setTagName ("TABLE"); } --- 34,70 ---- public class TableTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"TABLE"}; + + /** + * 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 table tag. + */ public TableTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * 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); } Index: Tag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Tag.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Tag.java 1 Nov 2003 21:55:43 -0000 1.55 --- Tag.java 6 Nov 2003 03:00:35 -0000 1.56 *************** *** 29,46 **** package org.htmlparser.tags; - import java.lang.CloneNotSupportedException; - import java.util.Enumeration; - import java.util.HashSet; - import java.util.Hashtable; - import java.util.Map; import java.util.Vector; - import org.htmlparser.AbstractNode; import org.htmlparser.lexer.Page; import org.htmlparser.lexer.nodes.TagNode; import org.htmlparser.scanners.TagScanner; import org.htmlparser.util.NodeList; - import org.htmlparser.util.ParserException; - import org.htmlparser.util.SpecialHashtable; import org.htmlparser.visitors.NodeVisitor; --- 29,38 ---- *************** *** 53,60 **** --- 45,71 ---- public class Tag extends TagNode implements Cloneable { + /** + * An empty set of tag names. + */ + private final static String[] NONE = new String[0]; + + /** + * The scanner for this tag. + */ private TagScanner mScanner; + + /** + * The default scanner for non-composite tags. + */ + protected final static TagScanner mDefaultScanner = new TagScanner (); public Tag () { + String[] names; + + names = getIds (); + if ((null != names) && (0 != names.length)) + setTagName (names[0]); + setThisScanner (mDefaultScanner); } *************** *** 74,77 **** --- 85,124 ---- { return (super.clone ()); + } + + /** + * Return the set of names handled by this tag. + * Since this a a generic tag, it has no ids. + * @return The names to be matched that create tags of this type. + */ + public String[] getIds () + { + return (NONE); + } + + /** + * Return the set of tag names that cause this tag to finish. + * These are the normal (non end tags) that if encountered while + * scanning (a composite tag) will cause the generation of a virtual + * tag. + * Since this a a non-composite tag, the default is no enders. + * @return The names of following tags that stop further scanning. + */ + public String[] getEnders () + { + return (NONE); + } + + /** + * Return the set of end tag names that cause this tag to finish. + * These are the end tags that if encountered while + * scanning (a composite tag) will cause the generation of a virtual + * tag. + * Since this a a non-composite tag, it has no end tag enders. + * @return The names of following end tags that stop further scanning. + */ + public String[] getEndTagEnders () + { + return (NONE); } Index: TextareaTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/TextareaTag.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** TextareaTag.java 26 Oct 2003 19:46:24 -0000 1.28 --- TextareaTag.java 6 Nov 2003 03:00:36 -0000 1.29 *************** *** 36,42 **** public class TextareaTag extends CompositeTag { public TextareaTag () { ! setTagName ("TEXTAREA"); } --- 36,86 ---- public class TextareaTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"TEXTAREA"}; + + /** + * The set of tag names that indicate the end of this tag. + */ + private static final String[] mEnders = new String[] {"INPUT", "TEXTAREA", "SELECT", "OPTION"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"FORM", "BODY", "HTML"}; + + /** + * Create a new text area tag. + */ public TextareaTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mEnders); ! } ! ! /** ! * 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); } Index: TitleTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/TitleTag.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** TitleTag.java 26 Oct 2003 19:46:24 -0000 1.29 --- TitleTag.java 6 Nov 2003 03:00:37 -0000 1.30 *************** *** 36,42 **** public class TitleTag extends CompositeTag { public TitleTag () { ! setTagName ("TITLE"); } --- 36,86 ---- public class TitleTag extends CompositeTag { + /** + * The set of names handled by this tag. + */ + private static final String[] mIds = new String[] {"TITLE"}; + + /** + * The set of tag names that indicate the end of this tag. + */ + private static final String[] mEnders = new String[] {"TITLE","BODY"}; + + /** + * The set of end tag names that indicate the end of this tag. + */ + private static final String[] mEndTagEnders = new String[] {"HEAD", "HTML"}; + + /** + * Create a new title tag. + */ public TitleTag () { ! } ! ! /** ! * Return the set of names handled by this tag. ! * @return The names to be matched that create tags of this type. ! */ ! public String[] getIds () ! { ! return (mIds); ! } ! ! /** ! * Return the set of tag names that cause this tag to finish. ! * @return The names of following tags that stop further scanning. ! */ ! public String[] getEnders () ! { ! return (mEnders); ! } ! ! /** ! * 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); } |