1 24 package org.riotfamily.website.template.config; 25 26 import org.springframework.beans.factory.config.BeanDefinition; 27 import org.springframework.beans.factory.xml.BeanDefinitionParser; 28 import org.springframework.beans.factory.xml.NamespaceHandlerSupport; 29 import org.springframework.beans.factory.xml.ParserContext; 30 import org.w3c.dom.Element ; 31 32 38 public class TemplateNamespaceHandler extends NamespaceHandlerSupport { 39 40 TemplateDefinitionParser definitionParser = new TemplateDefinitionParser(); 41 42 public void init() { 43 registerBeanDefinitionParser("config", new ConfigParser()); 44 registerBeanDefinitionParser("definition", definitionParser); 45 } 46 47 private class ConfigParser implements BeanDefinitionParser { 48 49 public BeanDefinition parse(Element element, ParserContext parserContext) { 50 definitionParser.setPrefix(element.getAttribute("prefix")); 51 definitionParser.setSuffix(element.getAttribute("suffix")); 52 return null; 53 } 54 55 } 56 57 } 58 | Popular Tags |