KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > module > sitemesh > parser > rules > ContentBlockExtractingRule


1 package com.opensymphony.module.sitemesh.parser.rules;
2
3 import com.opensymphony.module.sitemesh.HTMLPage;
4 import com.opensymphony.module.sitemesh.html.BlockExtractingRule;
5 import com.opensymphony.module.sitemesh.html.Tag;
6
7 public class ContentBlockExtractingRule extends BlockExtractingRule {
8
9     private final HTMLPage page;
10
11     private String JavaDoc contentBlockId;
12
13     public ContentBlockExtractingRule(HTMLPage page) {
14         super(false, "content");
15         this.page = page;
16     }
17
18     protected void start(Tag tag) {
19         contentBlockId = tag.getAttributeValue("tag");
20     }
21
22     protected void end(Tag tag) {
23         page.addProperty("page." + contentBlockId, context.currentBuffer().toString());
24     }
25
26 }
27
Popular Tags