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