日期:2014-05-19 浏览次数:20781 次
private void readFiles(List<String> filecontents) throws Exception {
// TODO Auto-generated method stub
for (int i=0;i< filecontents.size();i+=2){
String messageType = filecontents.get(i).split("\\.")[1];
SAXReader saxReader = new SAXReader();
Document doc = saxReader.read(new ByteArrayInputStream(filecontents.get(i+1).getBytes()));
Element root = doc.getRootElement();
Element foo;
if (messageType.equalsIgnoreCase("***")||messageType.equalsIgnoreCase("***")){
Trtask tk = new Trtask();
for (Iterator k = root.elementIterator("***"); k.hasNext();) {
foo = (Element) k.next();
messageType = foo.elementText("***");
tk.creationTime = Timestamp.valueOf(foo.elementText("creationTime").replace("T", " "));
tk.originatorAddress = getXmlEnumLabel(foo.elementText("***").trim(), "***");
tk.messageID = foo.elementText("messageID");
tk.messageType = messageType;
}
for (Iterator j = root.elementIterator("FileBody");j.hasNext();){
foo = (Element) j.next();
tk.sid = SpeedIDUtil.getId();
tk.fileContent = filecontents.get(i+1);
}
dao.insertOrUpdate(tk);
}else if(messageType.equalsIgnoreCase("***")||messageType.equalsIgnoreCase("***")){
Gendata gd = new Gendata();
for (Iterator k = root.elementIterator("FileHeader"); k.hasNext();) {
foo = (Element) k.next();
System.out.println("头文件部分"+foo.elementText("messageType"));