KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > htmlparser > scanners > Scanner


1 // HTMLParser Library $Name: v1_5_20050313 $ - A java-based parser for HTML
2
// http://sourceforge.org/projects/htmlparser
3
// Copyright (C) 2003 Derrick Oswald
4
//
5
// Revision Control Information
6
//
7
// $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/scanners/Scanner.java,v $
8
// $Author: derrickoswald $
9
// $Date: 2004/07/02 00:49:28 $
10
// $Revision: 1.2 $
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
//
26

27 package org.htmlparser.scanners;
28
29 import org.htmlparser.Tag;
30 import org.htmlparser.lexer.Lexer;
31 import org.htmlparser.util.NodeList;
32 import org.htmlparser.util.ParserException;
33
34 /**
35  * Generic interface for scanning.
36  * Tags needing specialized operations can provide an object that implements
37  * this interface via getThisScanner().
38  * By default non-composite tags simply perform the semantic action and
39  * return while composite tags will gather their children.
40  */

41 public interface Scanner
42 {
43     /**
44      * Scan the tag.
45      * The Lexer is provided in order to do a lookahead operation.
46      * @param tag HTML tag to be scanned for identification.
47      * @param lexer Provides html page access.
48      * @param stack The parse stack. May contain pending tags that enclose
49      * this tag. Nodes on the stack should be considered incomplete.
50      * @return The resultant tag (may be unchanged).
51      * @exception ParserException if an unrecoverable problem occurs.
52      */

53     public Tag scan (Tag tag, Lexer lexer, NodeList stack) throws ParserException;
54 }
55
Popular Tags