1 22 package org.enhydra.kelp.common.bridge; 23 24 import org.enhydra.xml.xmlc.XMLCError; 26 import org.enhydra.xml.xmlc.XMLCException; 27 import org.enhydra.xml.xmlc.dom.XMLCDocument; 28 import org.enhydra.xml.xmlc.compiler.Parse; 29 import org.enhydra.xml.xmlc.metadata.MetaData; 30 31 import java.io.PrintWriter ; 33 import java.io.IOException ; 34 35 public class ParserV2 implements Parser { 37 private PrintWriter traceWriter = null; 38 private MetaDataHandler handler = null; 39 private Parse parser = null; 40 41 public ParserV2(PrintWriter trace, MetaDataHandler metaData) { 42 traceWriter = trace; 43 handler = metaData; 44 Reporter reporter = null; 45 46 reporter = new Reporter(trace); 47 parser = new Parse(reporter, trace); 48 } 49 50 public XMLCDocument parse() throws XMLCException { 51 XMLCDocument doc = null; 52 MetaData metaData = null; 53 54 metaData = (MetaData) handler.getMetaData(); 55 try { 56 doc = parser.parse(metaData); 57 } catch (XMLCException xe) { 58 throw xe; 59 } catch (Exception e) { 60 e.printStackTrace(); 61 throw new XMLCException(e); 62 } catch (XMLCError e) { 63 e.printStackTrace(); 64 throw new XMLCException(e); 65 } catch (Error e) { 66 e.printStackTrace(); 67 throw new XMLCException(e); 68 } 69 return doc; 70 } 71 72 public MetaDataHandler getMetaDataHandler() { 73 return handler; 74 } 75 76 public void setMetaDataHandler(MetaDataHandler h) { 77 handler = h; 78 } 79 80 public PrintWriter getTraceWriter() { 81 return traceWriter; 82 } 83 84 } 85 | Popular Tags |