[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/io/xml XMLFileReader.java, 1.11, 1.12 XMLF
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-06-22 22:52:05
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7914/xml Modified Files: XMLFileReader.java XMLFileSpec.java XMLFileWriter.java Log Message: no message Index: XMLFileReader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml/XMLFileReader.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** XMLFileReader.java 21 Jun 2006 22:02:29 -0000 1.11 --- XMLFileReader.java 22 Jun 2006 22:52:01 -0000 1.12 *************** *** 35,45 **** * and returns the recrods on the needed basis. It finds the record location * using the xpath given in each xml record spec and loads all the child elements ! * of that xpath as a fields. Field values should be accessed using the element names. ! * If element has child elements, that returned value will be a reader record and * it again follow the same convention. If element is repeated more than once, * the value will be loaded as a list. ReaderRecord returned by this reader will * have additional methods used to read the data accurately. To find out how to read * each record from the file and to read the each field from the record, refer to the ! * FileReader javadoc. * </p> * --- 35,45 ---- * and returns the recrods on the needed basis. It finds the record location * using the xpath given in each xml record spec and loads all the child elements ! * as a fields. Field values should be accessed using the element names. ! * If element is a complex element, returned value will be a reader record and * it again follow the same convention. If element is repeated more than once, * the value will be loaded as a list. ReaderRecord returned by this reader will * have additional methods used to read the data accurately. To find out how to read * each record from the file and to read the each field from the record, refer to the ! * package javadoc. * </p> * *************** *** 207,211 **** * * @return Returns true if the first start element name matches with configured element name, ! * flase otherwise. */ private boolean validateRootElement() --- 207,211 ---- * * @return Returns true if the first start element name matches with configured element name, ! * false otherwise. */ private boolean validateRootElement() *************** *** 258,263 **** * Loads all the elements available in the stream from now onwards as a fields * into the record until we reach an end element matches the recordElement name. - * - * <i>TODO :: Eliminate Possible limitation :: Two elements with the same name cannot follow. </i> * </p> * --- 258,261 ---- *************** *** 298,305 **** EndElement endElement=(EndElement)reader.nextEvent(); isPreviousElementStart=false; ! if(recordElement.equalsIgnoreCase(endElement.getName().getLocalPart()) && elementStack.capacity()==0) { /** ! * End element name matches the starting element name of this record and no elements in stack. */ break; --- 296,303 ---- EndElement endElement=(EndElement)reader.nextEvent(); isPreviousElementStart=false; ! if(recordElement.equalsIgnoreCase(endElement.getName().getLocalPart()) && elementStack.empty()) { /** ! * End element name matches the starting element name of this record and stack is empty. */ break; Index: XMLFileWriter.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml/XMLFileWriter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** XMLFileWriter.java 13 Jun 2006 22:10:19 -0000 1.9 --- XMLFileWriter.java 22 Jun 2006 22:52:01 -0000 1.10 *************** *** 14,19 **** import java.io.Writer; import java.util.ArrayList; - import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; --- 14,19 ---- import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; + import java.util.LinkedHashMap; import java.util.List; import java.util.Map; *************** *** 30,40 **** /** * <p> ! * XMLFileWriter writes/generates the specified xml file according to the given file spec * with the the recrods submitted to write into the file. It generates the root tag * from the attribute given in file-spec. It uses the last part in record xpath to ! * write the record element. If nested element needs to be written, get another ! * record from the writer and writes it to the main record and submit the main ! * record to the writer. If repeated element needs to be written submit the values ! * as a list. * </p> * --- 30,38 ---- /** * <p> ! * XMLFileWriter writes the specified xml file according to the given file spec * with the the recrods submitted to write into the file. It generates the root tag * from the attribute given in file-spec. It uses the last part in record xpath to ! * write the record element. If nested elements or repeated elements needs to be written, ! * writer record provides the methods to write these elements. * </p> * *************** *** 282,286 **** super(recordType); this.isNestedElementRecord=isNestedElementRecord; ! fieldMap=new HashMap(); } --- 280,284 ---- super(recordType); this.isNestedElementRecord=isNestedElementRecord; ! fieldMap=new LinkedHashMap(); } Index: XMLFileSpec.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/xml/XMLFileSpec.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLFileSpec.java 10 Jun 2006 17:51:54 -0000 1.4 --- XMLFileSpec.java 22 Jun 2006 22:52:01 -0000 1.5 *************** *** 21,27 **** * XMLFileSpec represents the file spec defines the xml file * where each different kind of record identified by the xpath. ! * This file-spec requires additional attribute root-element which specified ! * root element of the xml file along with the file-type attribute. ! * Here is a sample file spec... * </p> * <p> --- 21,27 ---- * XMLFileSpec represents the file spec defines the xml file * where each different kind of record identified by the xpath. ! * This file-spec requires additional attribute root-element which specifies ! * root element of the xml file along with the file-type attribute, which is supposed ! * to be "xml". Here is a sample file spec... * </p> * <p> |