KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > htmlparser > NodeFactory


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/NodeFactory.java,v $
8
// $Author: derrickoswald $
9
// $Date: 2004/05/24 16:18:12 $
10
// $Revision: 1.1 $
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;
28
29 import java.util.Vector JavaDoc;
30
31 import org.htmlparser.Remark;
32 import org.htmlparser.Tag;
33 import org.htmlparser.Text;
34 import org.htmlparser.lexer.Page;
35 import org.htmlparser.util.ParserException;
36
37 /**
38  * This interface defines the methods needed to create new nodes.
39  * The factory is used when lexing to generate the nodes passed
40  * back to the caller.
41  */

42 public interface NodeFactory
43 {
44     /**
45      * Create a new string node.
46      * @param page The page the node is on.
47      * @param start The beginning position of the string.
48      * @param end The ending positiong of the string.
49      */

50     public Text createStringNode (Page page, int start, int end)
51         throws
52             ParserException;
53
54     /**
55      * Create a new remark node.
56      * @param page The page the node is on.
57      * @param start The beginning position of the remark.
58      * @param end The ending positiong of the remark.
59      */

60     public Remark createRemarkNode (Page page, int start, int end)
61         throws
62             ParserException;
63
64     /**
65      * Create a new tag node.
66      * Note that the attributes vector contains at least one element,
67      * which is the tag name (standalone attribute) at position zero.
68      * This can be used to decide which type of node to create, or
69      * gate other processing that may be appropriate.
70      * @param page The page the node is on.
71      * @param start The beginning position of the tag.
72      * @param end The ending positiong of the tag.
73      * @param attributes The attributes contained in this tag.
74      */

75     public Tag createTagNode (Page page, int start, int end, Vector JavaDoc attributes)
76         throws
77             ParserException;
78 }
79
Popular Tags