[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/io/xml sample-xml-file.xml, 1.1, 1.2 XMLFi
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-06-07 22:26:32
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16808 Modified Files: sample-xml-file.xml XMLFileReader.java Log Message: no message Index: sample-xml-file.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml/sample-xml-file.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sample-xml-file.xml 3 Jun 2006 13:14:42 -0000 1.1 --- sample-xml-file.xml 5 Jun 2006 03:13:11 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- </sample-field3> <sample-field4>sample-value1</sample-field4> + <sample-field5> </sample-field5> </sample-detail> <sample-trailor> Index: XMLFileReader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml/XMLFileReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLFileReader.java 3 Jun 2006 13:14:42 -0000 1.1 --- XMLFileReader.java 5 Jun 2006 03:13:11 -0000 1.2 *************** *** 11,15 **** --- 11,19 ---- package org.jmonks.batchserver.io.xml; + import java.io.FileNotFoundException; import java.util.Map; + import javax.xml.stream.XMLEventReader; + import javax.xml.stream.XMLInputFactory; + import javax.xml.stream.XMLStreamException; import org.apache.log4j.Logger; import org.jmonks.batchserver.io.*; *************** *** 25,28 **** --- 29,34 ---- protected FileSpec fileSpec=null; + protected XMLEventReader reader=null; + private static Logger logger=Logger.getLogger(XMLFileReader.class); *************** *** 31,34 **** --- 37,57 ---- this.absoluteFilePath=absoluteFilePath; this.fileSpec=fileSpec; + try + { + XMLInputFactory inputFactory=XMLInputFactory.newInstance(); + reader=inputFactory.createXMLEventReader(new java.io.FileReader(this.absoluteFilePath)); + } + catch(FileNotFoundException exception) + { + exception.printStackTrace(); + logger.fatal("File to create the reader cannot be found. Exception Message = " + exception.getMessage(),exception); + throw new FileParseException("File to create the reader cannot be found. Exception Message = " + exception.getMessage()); + } + catch(XMLStreamException exception) + { + exception.printStackTrace(); + logger.fatal("Exception while initializing the xml stream reader. Message = " + exception.getMessage(),exception); + throw new FileParseException("Exception while initializing the xml stream reader. Message = " + exception.getMessage()); + } } *************** *** 38,41 **** --- 61,72 ---- } + public void close() + { + if(this.reader!=null) + { + this.reader.close(); + } + } + public class XMLReaderRecord extends ReaderRecord { |