1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 | package Torello.HTML.NodeSearch.SearchLoops.L1Inclusive;
import java.util.Vector;
import Torello.HTML.*;
import Torello.HTML.NodeSearch.InclusiveException;
import Torello.Java.LV;
public class TNGetL1Incl
{
public static Vector<Vector<HTMLNode>> all (Vector<? extends HTMLNode> html, LV l, String htmlTag)
{
InclusiveException.check(htmlTag);
Vector<Vector<HTMLNode>> ret = new Vector<>();
DotPair dp;
TagNode tn;
for (int i = l.start; i < l.end; i++)
if ((tn = html.elementAt(i).openTag()) != null)
if (tn.tok.equals(htmlTag))
{
if ((dp = Util.Inclusive.dotPairOPT(html, i, l.end)) != null)
{
ret.addElement(DPUtil.toVector(html, dp));
i = dp.end; // i++ will happen immediately after this line!
}
else break; // If there is an "opened" TagNode (such as <A>),
// but no matching-close node, break the loop immediately!
// If this were "NOT AN L1" search, you would NOT BREAK here!
// **BECAUSE** this is L1, **THEREFORE** break!
}
return ret;
}
}
|