1 18 19 package org.objectweb.jac.core.parsers.xml; 20 21 import java.io.InputStream ; 22 23 import org.w3c.dom.*; 24 25 import org.objectweb.jac.util.URLInputStream; 26 27 public class XmlConfig { 28 29 public static final String methodElementTagName = "method"; 31 32 36 public XmlConfig(InputStream inputStream, 37 String fileLocation, 38 Class targetClass) 39 throws Exception 40 { 41 XmlParserJAXP xmlParser = new XmlParserJAXP(); 42 Document document = xmlParser.parse( inputStream, false ); 43 44 ACElementInterpreter acElementInterpreter = new ACElementInterpreter(); 46 47 DefaultDocumentInterpreter documentInterpreter = new DefaultDocumentInterpreter(); 49 50 documentInterpreter.setElementInterpreter( acElementInterpreter ); 52 53 documentInterpreter.interpret(document, targetClass); 55 } 56 57 61 public static void main(String [] args) throws Exception { 62 if ( args.length != 2 ) 63 System.err.println("usage: java XmlConfig <target_class> <xml_document>"); 64 else 65 new XmlConfig( new URLInputStream(args[0]).getInputStream(), 66 args[0], 67 Class.forName(args[1]) ); 68 69 System.exit(0); 70 } 71 72 } 73 | Popular Tags |