1 19 20 33 package org.htmlparser.scanners; 34 35 import java.util.Stack ; 36 37 import org.htmlparser.tags.Bullet; 38 import org.htmlparser.tags.Tag; 39 import org.htmlparser.tags.data.CompositeTagData; 40 import org.htmlparser.tags.data.TagData; 41 import org.htmlparser.util.ParserException; 42 43 52 public class BulletScanner extends CompositeTagScanner 53 { 54 private static final String [] MATCH_STRING = { "LI" }; 55 private final static String ENDERS[] = { "BODY", "HTML" }; 56 private final static String END_TAG_ENDERS[] = { "UL" }; 57 private Stack ulli; 58 59 public BulletScanner(Stack ulli) 60 { 61 this("", ulli); 62 } 63 64 public BulletScanner(String filter, Stack ulli) 65 { 66 super(filter, MATCH_STRING, ENDERS, END_TAG_ENDERS, false); 67 this.ulli = ulli; 68 } 69 70 public Tag createTag(TagData tagData, CompositeTagData compositeTagData) 71 throws ParserException 72 { 73 return new Bullet(tagData, compositeTagData); 74 } 75 76 public String [] getID() 77 { 78 return MATCH_STRING; 79 } 80 81 84 public boolean shouldCreateEndTagAndExit() 85 { 86 if (ulli.size() == 0) 87 return false; 88 CompositeTagScanner parentScanner = (CompositeTagScanner) ulli.peek(); 89 if (parentScanner == this) 90 { 91 ulli.pop(); 92 return true; 93 } 94 else 95 return false; 96 } 97 98 public void beforeScanningStarts() 99 { 100 ulli.push(this); 101 } 102 103 } 104 | Popular Tags |