Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
IRule |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // Unless required by applicable law or agreed to in writing, software |
|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 | // See the License for the specific language governing permissions and |
|
13 | // limitations under the License. |
|
14 | ||
15 | package org.apache.tapestry.util.xml; |
|
16 | ||
17 | import org.xml.sax.Attributes; |
|
18 | ||
19 | /** |
|
20 | * A rule that may be pushed onto the |
|
21 | * {@link org.apache.tapestry.util.xml.RuleDirectedParser}'s rule stack. A rule |
|
22 | * is associated with an XML element. It is pushed onto the stack when the open |
|
23 | * tag for the rule is encountered. It is is popped off the stack after the |
|
24 | * end-tag is encountered. It is notified about any text it directly wraps |
|
25 | * around. |
|
26 | * <p> |
|
27 | * Rules should be stateless, because a rule instance may appear multiple times |
|
28 | * in the rule stack (if elements can be recusively nested). |
|
29 | * |
|
30 | * @author Howard Lewis Ship |
|
31 | * @since 3.0 |
|
32 | */ |
|
33 | ||
34 | public interface IRule |
|
35 | { |
|
36 | ||
37 | /** |
|
38 | * Invoked just after the rule is pushed onto the rule stack. Typically, a |
|
39 | * Rule will use the information to create a new object and push it onto the |
|
40 | * object stack. If the rule needs to know about the element (rather than |
|
41 | * the attributes), it may obtain the URI, localName and qName from the |
|
42 | * parser. |
|
43 | */ |
|
44 | void startElement(RuleDirectedParser parser, Attributes attributes); |
|
45 | ||
46 | /** |
|
47 | * Invoked just after the rule is popped off the rule stack. |
|
48 | */ |
|
49 | void endElement(RuleDirectedParser parser); |
|
50 | ||
51 | /** |
|
52 | * Invoked when real content is found. The parser is responsible for |
|
53 | * aggregating all content provided by the underlying SAX parser into a |
|
54 | * single string. |
|
55 | */ |
|
56 | ||
57 | void content(RuleDirectedParser parser, String content); |
|
58 | } |