KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > transformer > TransformerService


1 /*
2  * Copyright 2000-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.services.transformer;
18
19 //standard java stuff
20
import java.io.Reader JavaDoc;
21
22 // turbine stuff
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 JavaDoc 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 JavaDoc findElement(Reader JavaDoc htmlReader, String JavaDoc url, String JavaDoc 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 JavaDoc clipElements(
55         Reader JavaDoc htmlReader,
56         String JavaDoc url,
57         String JavaDoc startElement,
58         String JavaDoc 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 JavaDoc findElementNumber(
74         Reader JavaDoc htmlReader,
75         String JavaDoc url,
76         String JavaDoc 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 JavaDoc clipElementsNumber(
95         Reader JavaDoc htmlReader,
96         String JavaDoc url,
97         String JavaDoc startElement,
98         String JavaDoc stopElement,
99         int tagNumber);
100 }
101
Popular Tags