1 52 53 package freemarker.testcase; 54 55 import java.util.HashMap ; 56 import java.util.Map ; 57 58 import org.jdom.Document; 59 import org.jdom.input.SAXBuilder; 60 import org.xml.sax.InputSource ; 61 import freemarker.ext.beans.BeansWrapper; 62 import freemarker.ext.jdom.NodeListModel; 63 import freemarker.template.SimpleHash; 64 65 69 public class TestXmlModel extends AbstractTestCase 70 { 71 public TestXmlModel(String name) 72 { 73 super(name); 74 } 75 76 79 public void setUp() 80 throws 81 Exception 82 { 83 setUpFiles( "test-xml.html" ); 84 85 Document doc = new SAXBuilder().build(new InputSource (getClass().getResourceAsStream("test-xml.xml"))); 86 Map map = new HashMap (); 87 map.put("doc", new NodeListModel(doc)); 88 root = new SimpleHash(map, BeansWrapper.getDefaultInstance()); 89 } 90 91 93 public static void main( String [] argc ) throws Exception { 94 AbstractTestCase cTest = new TestXmlModel( "test-xml.html" ); 95 cTest.run(); 96 } 97 } 98 | Popular Tags |