1 16 package org.apache.cocoon.forms.formmodel; 17 18 import org.apache.cocoon.forms.formmodel.library.Library; 19 import org.apache.cocoon.forms.util.DomHelper; 20 import org.w3c.dom.Element ; 21 22 23 26 public class ImportDefinitionBuilder extends AbstractWidgetDefinitionBuilder { 27 28 public static final String PREFIX_ATTRIBUTE = "prefix"; 29 public static final String URI_ATTRIBUTE = "uri"; 30 31 34 public WidgetDefinition buildWidgetDefinition(Element widgetElement) 35 throws Exception { 36 37 if(this.context == null || this.context.getLocalLibrary() == null) 38 throw new Exception ("Import statement seen and context is empty! (at "+DomHelper.getLocation(widgetElement)+")"); 39 40 Library lib = this.context.getLocalLibrary(); 41 String prefix = DomHelper.getAttribute(widgetElement, PREFIX_ATTRIBUTE); 42 String uri = DomHelper.getAttribute(widgetElement, URI_ATTRIBUTE); 43 44 if(!lib.includeAs(prefix,uri)) 45 throw new Exception ("Import statement did not succeed (probably used ':' in the prefix?)! (at "+DomHelper.getLocation(widgetElement)+")"); 46 47 return null; 48 } 49 50 } 51 | Popular Tags |