Source code: org/htmlparser/tags/data/TagData.java
1 // $Header: /home/cvs/jakarta-jmeter/src/htmlparser/org/htmlparser/tags/data/TagData.java,v 1.2 2004/02/10 13:41:08 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.tags.data;
34
35 public class TagData
36 {
37 private int tagBegin;
38 private int tagEnd;
39 private int startLine;
40 private int endLine;
41 private String tagContents;
42 private String tagLine;
43 private String urlBeingParsed;
44 private boolean isXmlEndTag;
45
46 public TagData(
47 int tagBegin,
48 int tagEnd,
49 String tagContents,
50 String tagLine)
51 {
52 this(tagBegin, tagEnd, 0, 0, tagContents, tagLine, "", false);
53 }
54
55 public TagData(
56 int tagBegin,
57 int tagEnd,
58 String tagContents,
59 String tagLine,
60 String urlBeingParsed)
61 {
62 this(
63 tagBegin,
64 tagEnd,
65 0,
66 0,
67 tagContents,
68 tagLine,
69 urlBeingParsed,
70 false);
71 }
72
73 public TagData(
74 int tagBegin,
75 int tagEnd,
76 int startLine,
77 int endLine,
78 String tagContents,
79 String tagLine,
80 String urlBeingParsed,
81 boolean isXmlEndTag)
82 {
83 this.tagBegin = tagBegin;
84 this.tagEnd = tagEnd;
85 this.startLine = startLine;
86 this.endLine = endLine;
87 this.tagContents = tagContents;
88 this.tagLine = tagLine;
89 this.urlBeingParsed = urlBeingParsed;
90 this.isXmlEndTag = isXmlEndTag;
91 }
92
93 public int getTagBegin()
94 {
95 return tagBegin;
96 }
97
98 public String getTagContents()
99 {
100 return tagContents;
101 }
102
103 public int getTagEnd()
104 {
105 return tagEnd;
106 }
107
108 public String getTagLine()
109 {
110 return tagLine;
111 }
112
113 public void setTagContents(String tagContents)
114 {
115 this.tagContents = tagContents;
116 }
117
118 public String getUrlBeingParsed()
119 {
120 return urlBeingParsed;
121 }
122
123 public void setUrlBeingParsed(String baseUrl)
124 {
125 this.urlBeingParsed = baseUrl;
126 }
127
128 public boolean isEmptyXmlTag()
129 {
130 return isXmlEndTag;
131 }
132
133 /**
134 * Returns the line number where the tag starts in the HTML. At the moment this
135 * will only be valid for tags created with the
136 * <code>CompositeTagScanner</code> or a subclass of it.
137 */
138 public int getStartLine()
139 {
140 return startLine;
141 }
142
143 /**
144 * Returns the line number where the tag ends in the HTML. At the moment this
145 * will only be valid for tags created with the
146 * <code>CompositeTagScanner</code> or a subclass of it.
147 */
148 public int getEndLine()
149 {
150 return endLine;
151 }
152
153 }