01: /*
02: * $Id: IMarkupFilter.java 458787 2006-01-20 13:07:21Z jdonnerstag $
03: * $Revision: 458787 $ $Date: 2006-01-20 14:07:21 +0100 (Fri, 20 Jan 2006) $
04: *
05: * ==============================================================================
06: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
07: * use this file except in compliance with the License. You may obtain a copy of
08: * the License at
09: *
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, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.markup.parser;
19:
20: import java.text.ParseException;
21:
22: import wicket.markup.MarkupElement;
23:
24: /**
25: * Wicket uses a streaming XML parser to read the markup. A chain of
26: * IMarkupFilters is used e.g. to remove comments, allow for html typical markup
27: * (some tags don't need to be closed explicitly), etc.
28: * <p>
29: * The streaming XML parser must implement IMarkupFilter itself and thus is
30: * usually the first element of the chain.
31: *
32: * @see wicket.markup.MarkupParser
33: * @author Juergen Donnerstag
34: */
35: public interface IMarkupFilter {
36: /**
37: * IMarkupFilters are usually chained with the last filter being an XML
38: * parser. The getParent() method returns the next filter in the chain.
39: *
40: * @return The next filter in the chain, or null if the last one.
41: */
42: IMarkupFilter getParent();
43:
44: /**
45: * Get the next MarkupElement from the parent MarkupFilter and handle it if
46: * the specific filter criteria are met. Depending on the filter, it may
47: * return the MarkupElement unchanged, modified or it remove by asking the
48: * parent handler for the next tag.
49: *
50: * @return Return the next eligible MarkupElement
51: * @throws ParseException
52: */
53: MarkupElement nextTag() throws ParseException;
54:
55: /**
56: * Set parent filter.
57: *
58: * @param parent
59: * The next element in the chain
60: */
61: void setParent(final IMarkupFilter parent);
62: }
|