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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.transformer;
1819//standard java stuff20import java.io.Reader;
2122// turbine stuff23import org.apache.turbine.services.Service;
2425/***26 * This service is responsible for locate and transform HTML content27 * 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 */31publicinterfaceTransformerServiceextends Service
32 {
3334/*** The name of this service */35public String SERVICE_NAME = "Transformer";
3637/***38 * Finds an element in a web page39 * 40 * @param htmlReader Reader for the html rewriter41 * @param url page address42 * @param element the element to search43 */44public String findElement(Reader htmlReader, String url, String element);
4546/***47 * Clips the part of a web page between startElement and stopElement48 * 49 * @param htmlReader Reader for the html rewriter50 * @param url page address51 * @param startElement the first element to clip52 * @param stopElement the last element to clip53 */54public String clipElements(
55 Reader htmlReader,
56 String url,
57 String startElement,
58 String stopElement);
5960/***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 rewriter69 * @param url page address70 * @param element the element to search71 * @param tagNumber the number of the element to search72 */73public String findElementNumber(
74 Reader htmlReader,
75 String url,
76 String element,
77int tagNumber);
7879/***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 here86 * ........<img> <---Stops here87 * 88 * @param htmlReader Reader for the html rewriter89 * @param url page address90 * @param startElement the first element to clip91 * @param stopElement the last element to clip92 * @param tagNumber the number of the first element to clip93 */94public String clipElementsNumber(
95 Reader htmlReader,
96 String url,
97 String startElement,
98 String stopElement,
99int tagNumber);
100 }