1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.services.transformer;
18
19
20 import java.io.Reader;
21
22
23 import org.apache.turbine.services.Service;
24
25 /***
26 * This service is responsible for locate and transform HTML content
27 *
28 * @author <a href="mailto:mmari@ce.unipr.it">Marco Mari</a>
29 * @version $Id: TransformerService.java,v 1.2 2004/02/23 03:39:10 jford Exp $
30 */
31 public interface TransformerService extends Service
32 {
33
34 /*** The name of this service */
35 public String SERVICE_NAME = "Transformer";
36
37 /***
38 * Finds an element in a web page
39 *
40 * @param htmlReader Reader for the html rewriter
41 * @param url page address
42 * @param element the element to search
43 */
44 public String findElement(Reader htmlReader, String url, String element);
45
46 /***
47 * Clips the part of a web page between startElement and stopElement
48 *
49 * @param htmlReader Reader for the html rewriter
50 * @param url page address
51 * @param startElement the first element to clip
52 * @param stopElement the last element to clip
53 */
54 public String clipElements(
55 Reader htmlReader,
56 String url,
57 String startElement,
58 String stopElement);
59
60 /***
61 * Finds in an HTML page the "tagNumber" tag of type "element"
62 * Example: element = "p", tagNumber = "3"
63 * Page content:
64 * <p>..</p>
65 * <p>..</p>
66 * <p>.. <---Finds this
67 *
68 * @param htmlReader Reader for the html rewriter
69 * @param url page address
70 * @param element the element to search
71 * @param tagNumber the number of the element to search
72 */
73 public String findElementNumber(
74 Reader htmlReader,
75 String url,
76 String element,
77 int tagNumber);
78
79 /***
80 * Clips a part of a web page, starting from the "tagNumber" "startElement"
81 * Example: startElement = "p", tagNumber = "3", stopElement = "img"
82 * Page content:
83 * <p>..</p>
84 * <p>..</p>
85 * <p>.. <---Starts here
86 * ........<img> <---Stops here
87 *
88 * @param htmlReader Reader for the html rewriter
89 * @param url page address
90 * @param startElement the first element to clip
91 * @param stopElement the last element to clip
92 * @param tagNumber the number of the first element to clip
93 */
94 public String clipElementsNumber(
95 Reader htmlReader,
96 String url,
97 String startElement,
98 String stopElement,
99 int tagNumber);
100 }