jdoc解析xml

package com.sinosoft.dp.build;

import java.io.File;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;

public class ReadXml {
   public static void main(String args[]) throws Exception{
    SAXBuilder builder =new SAXBuilder();
    Document read_doc=builder.build("h:"+File.separator+"Bdzt.xml");
    Element stu=read_doc.getRootElement();
    Element stu2=stu.getChild("BODY");
    List list=stu2.getChildren("POLICY_INFO");   
    for(int i=0;i<list.size();i++){
     Element e=(Element) list.get(i);
     String POLICY_SEQUENCE_NO=e.getChildText("POLICY_SEQUENCE_NO");
     String ENDORSEMENT_NO=e.getChildText("ENDORSEMENT_NO");
     String POLICY_STATUS=e.getChildText("POLICY_STATUS");
     String SUSPENSION_DATE=e.getChildText("SUSPENSION_DATE");
     String TERMINATION_DATE=e.getChildText("TERMINATION_DATE");
     String REINSTATEMENT_DATE=e.getChildText("REINSTATEMENT_DATE");
     String EFFECTIVE_DATE=e.getChildText("EFFECTIVE_DATE");
     System.out.println(POLICY_SEQUENCE_NO+" "+ENDORSEMENT_NO+" "+POLICY_STATUS+" "+SUSPENSION_DATE
       +" "+TERMINATION_DATE+" "+REINSTATEMENT_DATE+" "+EFFECTIVE_DATE);
     System.out.println("一轮完毕");
    
    }
   
   
   
  
   }
}

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页