KickJava   Java API By Example, From Geeks To Geeks.

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


1 // $Header: /home/cvs/jakarta-jmeter/src/htmlparser/org/htmlparser/scanners/TableRowScanner.java,v 1.2 2004/02/10 13:41:09 woolfel Exp $
2
/*
3  * ====================================================================
4  * Copyright 2002-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */

19
20 // The developers of JMeter and Apache are greatful to the developers
21
// of HTMLParser for giving Apache Software Foundation a non-exclusive
22
// license. The performance benefits of HTMLParser are clear and the
23
// users of JMeter will benefit from the hard work the HTMLParser
24
// team. For detailed information about HTMLParser, the project is
25
// hosted on sourceforge at http://htmlparser.sourceforge.net/.
26
//
27
// HTMLParser was originally created by Somik Raha in 2000. Since then
28
// a healthy community of users has formed and helped refine the
29
// design so that it is able to tackle the difficult task of parsing
30
// dirty HTML. Derrick Oswald is the current lead developer and was kind
31
// enough to assist JMeter.
32

33 package org.htmlparser.scanners;
34
35 import org.htmlparser.Parser;
36 import org.htmlparser.tags.TableColumn;
37 import org.htmlparser.tags.TableRow;
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.NodeList;
42
43 public class TableRowScanner extends CompositeTagScanner
44 {
45     private final static String JavaDoc MATCH_STRING[] = { "TR" };
46
47     public TableRowScanner(Parser parser)
48     {
49         this("", parser);
50     }
51
52     public TableRowScanner(String JavaDoc filter, Parser parser)
53     {
54         this(filter, parser, MATCH_STRING, new String JavaDoc[] {
55         }, new String JavaDoc[] {
56         }, false);
57     }
58
59     public TableRowScanner(
60         String JavaDoc filter,
61         Parser parser,
62         String JavaDoc[] nameOfTagToMatch,
63         String JavaDoc[] tagEnders,
64         String JavaDoc[] endTagEnders,
65         boolean allowSelfChildren)
66     {
67         super(
68             filter,
69             nameOfTagToMatch,
70             tagEnders,
71             endTagEnders,
72             allowSelfChildren);
73         parser.addScanner(new TableColumnScanner());
74     }
75
76     public Tag createTag(TagData tagData, CompositeTagData compositeTagData)
77     {
78         NodeList columns =
79             compositeTagData.getChildren().searchFor(TableColumn.class);
80         return new TableRow(tagData, compositeTagData, columns);
81     }
82
83     public String JavaDoc[] getID()
84     {
85         return MATCH_STRING;
86     }
87
88 }
89
Popular Tags