SAXParser读取超大型xml
<br />利用dom解析xml需要一次性加载所有的xml内容 内容太大就要加大虚拟机的内存,如果超大,内存无法存放的话<br />就只能采用流的形式了<br /> <br />xml内容<br /> -<NewDataSet xmlns="">-<ExecResult diffgr:id="ExecResult1" msdata:rowOrder="0" diffgr:hasChanges="i
·
利用dom解析xml需要一次性加载所有的xml内容 内容太大就要加大虚拟机的内存,如果超大,内存无法存放的话
就只能采用流的形式了
xml内容
-
<
ExecResult diffgr:id
="
ExecResult1
"
msdata:rowOrder
="
0
"
diffgr:hasChanges
="
inserted
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
ResultValue
>
True
</
ResultValue
>
<
ResultInfo
>
登录成功!
</
ResultInfo
>
<
StatDateTime
>
2011-4-21
</
StatDateTime
>
</
ExecResult
>
-
<
INTENT diffgr:id
="
INTENT2
"
msdata:rowOrder
="
1
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
INTENTID
>
8304885
</
INTENTID
>
<
ADDCODE
>
4407
</
ADDCODE
>
<
SENDDATE
>
2011-04-15 21:47:52
</
SENDDATE
>
<
NMEMBERID
>
300479
</
NMEMBERID
>
<
SMEMBERID
>
167131
</
SMEMBERID
>
<
THEITEMID
>
6642238
</
THEITEMID
>
<
COMMODITYID
>
88491
</
COMMODITYID
>
<
BATCH
>
400
</
BATCH
>
<
PRICE
>
29.2200
</
PRICE
>
<
INNERID
>
20209
</
INNERID
>
<
PROJECTID
>
260
</
PROJECTID
>
</
INTENT
>
-
<
SENDPRODUCT diffgr:id
="
SENDPRODUCT4602
"
msdata:rowOrder
="
4601
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
THEITEMID
>
6360192
</
THEITEMID
>
<
ADDCODE
>
4418
</
ADDCODE
>
<
SENDQUANTITY
>
48
</
SENDQUANTITY
>
<
BATCHTXT
>
10071002
</
BATCHTXT
>
<
BILLNUMBER
/>
<
VALIDITYDATE
>
2012-1-9 0:00:00
</
VALIDITYDATE
>
<
INVOICENUMBER
/>
<
SENDDATE
>
2011-04-15 17:40:10
</
SENDDATE
>
<
PROJECTID
>
260
</
PROJECTID
>
<
INNERID
>
3066
</
INNERID
>
<
NMEMBERID
>
300370
</
NMEMBERID
>
<
SMEMBERID
>
166980
</
SMEMBERID
>
<
COMMONDITYID
>
49511
</
COMMONDITYID
>
<
GUIDCODE
/>
</
SENDPRODUCT
>
-
<
PUBLIC_MEMBER diffgr:id
="
PUBLIC_MEMBER1
"
msdata:rowOrder
="
0
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
MEMBERID
>
305659
</
MEMBERID
>
<
MEMBERCLASSID
>
1
</
MEMBERCLASSID
>
<
MEMBERCLASSNAME
>
医疗机构
</
MEMBERCLASSNAME
>
<
MEMBERNAME
>
惠州市惠城区横沥医院
</
MEMBERNAME
>
<
ADDCODE
>
441302
</
ADDCODE
>
<
TELEPHONE
>
13652772813
</
TELEPHONE
>
<
FAX
>
0752-3185010
</
FAX
>
<
ZIP
>
516253
</
ZIP
>
<
THEADDRESS
>
惠州市惠城区横沥镇解放路184号
</
THEADDRESS
>
<
EMAIL
>
heng1958@163.com
</
EMAIL
>
<
CONTACT
>
邹宣平
</
CONTACT
>
</
PUBLIC_MEMBER
>
-
<
PUBLIC_MEMBER_INFO diffgr:id
="
PUBLIC_MEMBER_INFO1
"
msdata:rowOrder
="
0
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
MEMBERID
>
26508
</
MEMBERID
>
<
LICENSEID
>
粤HB20060033
</
LICENSEID
>
<
REG_ADDRESS
>
广州增城市中新镇风光路178号
</
REG_ADDRESS
>
<
DEPUTY
>
陈桂恩
</
DEPUTY
>
<
PRESIDENT
>
陈桂恩
</
PRESIDENT
>
<
QUANLITYPRINCIPAL
/>
<
SALESMODE
/>
<
PUBLICDEPARTMENT
/>
<
PROCESSSPAN
>
2010-12-31 00:00:00
</
PROCESSSPAN
>
</
PUBLIC_MEMBER_INFO
>
-
<
Product diffgr:id
="
Product478
"
msdata:rowOrder
="
477
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
THEITEMID
>
412
</
THEITEMID
>
<
ADDCODE
>
4401
</
ADDCODE
>
<
SENDQUANTITY
>
1
</
SENDQUANTITY
>
<
BATCHTXT
>
11
</
BATCHTXT
>
<
BILLNUMBER
/>
<
VALIDITYDATE
>
2
</
VALIDITYDATE
>
<
INVOICENUMBER
>
FP201103
</
INVOICENUMBER
>
<
SENDDATE
>
2011-03-28 17:45:26
</
SENDDATE
>
<
PROJECTID
>
142
</
PROJECTID
>
<
INNERID
>
1
</
INNERID
>
<
NMEMBERID
>
166764
</
NMEMBERID
>
<
SMEMBERID
>
156400
</
SMEMBERID
>
<
COMMONDITYID
>
328000
</
COMMONDITYID
>
</
Product
>
-
<
COMMODITY diffgr:id
="
COMMODITY1
"
msdata:rowOrder
="
0
"
xmlns:diffgr
="
urn:schemas-microsoft-com:xml-diffgram-v1
"
xmlns:msdata
="
urn:schemas-microsoft-com:xml-msdata
">
<
COMMODITYID
>
53829
</
COMMODITYID
>
<
PROJECTID
>
260
</
PROJECTID
>
<
TRADENAME
>
注射用亚叶酸钙
</
TRADENAME
>
<
DOSE
>
注射用无菌粉末(冻干粉针)
</
DOSE
>
<
SPEC
>
0.1g
</
SPEC
>
<
PACKSPEC
>
1支/盒
</
PACKSPEC
>
<
UNIT
>
支
</
UNIT
>
<
PRODUCER_MEMBER_ID
>
155316
</
PRODUCER_MEMBER_ID
>
<
PNAME
>
山西普德药业股份有限公司
</
PNAME
>
<
APPROVE_NO
>
国药准字H14022464
</
APPROVE_NO
>
<
DRUG_NAME
>
亚叶酸钙
</
DRUG_NAME
>
<
DRUG_ID
>
5967
</
DRUG_ID
>
<
DRUG_TYPE
>
1
</
DRUG_TYPE
>
<
GMP_TYPE
>
1
</
GMP_TYPE
>
<
GMP_NUMBER
>
G3662
</
GMP_NUMBER
>
<
GMP_ENDDATE
>
2010-12-13 00:00:00
</
GMP_ENDDATE
>
<
CONTROLID
>
1
</
CONTROLID
>
<
INNERID
>
33824
</
INNERID
>
<
THESTATE
>
1
</
THESTATE
>
<
COMMODITYIDFORTC
>
53829
</
COMMODITYIDFORTC
>
<
ISBASECOMM
>
0
</
ISBASECOMM
>
</
COMMODITY
>
</
NewDataSet
>
利用sax读取xml 内容是有技巧性的 比如如何处理 相同名字的节点 中文的话 他会一个字一个字的度的问题
一下代码给出解释:
package cn.net.tc.yjj.core.utils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Date;
import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import cn.net.tc.yjj.system.dto.Commodity;
import cn.net.tc.yjj.system.dto.Intent;
import cn.net.tc.yjj.system.dto.PublicMember;
import cn.net.tc.yjj.system.dto.PublicMemberInfo;
import cn.net.tc.yjj.system.dto.SendProduct;
import cn.net.tc.yjj.system.dto.Intent;
import cn.net.tc.yjj.system.dto.PublicMember;
import cn.net.tc.yjj.system.dto.PublicMemberInfo;
import cn.net.tc.yjj.system.dto.SendProduct;
public class SaxXmlUtil extends DefaultHandler {
//总计有多少条数据
private long total=0;
String INTENT_INTENTID = "//NewDataSet//INTENT//INTENTID";
String INTENT_ADDCODE = "//NewDataSet//INTENT//ADDCODE";
String INTENT_SENDDATE = "//NewDataSet//INTENT//SENDDATE";
String INTENT_NMEMBERID = "//NewDataSet//INTENT//NMEMBERID";
String INTENT_SMEMBERID = "//NewDataSet//INTENT//SMEMBERID";
String INTENT_THEITEMID = "//NewDataSet//INTENT//THEITEMID";
String INTENT_COMMODITYID = "//NewDataSet//INTENT//COMMODITYID";
String INTENT_BATCH = "//NewDataSet//INTENT//BATCH";
String INTENT_PRICE = "//NewDataSet//INTENT//PRICE";
String INTENT_INNERID = "//NewDataSet//INTENT//INNERID";
String INTENT_PROJECTID = "//NewDataSet//INTENT//PROJECTID";
String SENDPRODUCT_THEITEMID = "//NewDataSet//SENDPRODUCT//THEITEMID";
String SENDPRODUCT_ADDCODE = "//NewDataSet//SENDPRODUCT//ADDCODE";
String SENDPRODUCT_SENDQUANTITY = "//NewDataSet//SENDPRODUCT//SENDQUANTITY";
String SENDPRODUCT_BATCHTXT = "//NewDataSet//SENDPRODUCT//BATCHTXT";
String SENDPRODUCT_BILLNUMBER = "//NewDataSet//SENDPRODUCT//BILLNUMBER";
String SENDPRODUCT_VALIDITYDATE = "//NewDataSet//SENDPRODUCT//VALIDITYDATE";
String SENDPRODUCT_INVOICENUMBER = "//NewDataSet//SENDPRODUCT//INVOICENUMBER";
String SENDPRODUCT_SENDDATE = "//NewDataSet//SENDPRODUCT//SENDDATE";
String SENDPRODUCT_PROJECTID = "//NewDataSet//SENDPRODUCT//PROJECTID";
String SENDPRODUCT_INNERID = "//NewDataSet//SENDPRODUCT//INNERID";
String SENDPRODUCT_NMEMBERID = "//NewDataSet//SENDPRODUCT//NMEMBERID";
String SENDPRODUCT_SMEMBERID = "//NewDataSet//SENDPRODUCT//SMEMBERID";
String SENDPRODUCT_COMMONDITYID = "//NewDataSet//SENDPRODUCT//COMMONDITYID";
String SENDPRODUCT_GUIDCODE = "//NewDataSet//SENDPRODUCT//GUIDCODE";
String PUBLIC_MEMBER_MEMBERID = "//NewDataSet//PUBLIC_MEMBER//MEMBERID";
String PUBLIC_MEMBER_MEMBERCLASSID = "//NewDataSet//PUBLIC_MEMBER//MEMBERCLASSID";
String PUBLIC_MEMBER_MEMBERCLASSNAME = "//NewDataSet//PUBLIC_MEMBER//MEMBERCLASSNAME";
String PUBLIC_MEMBER_MEMBERNAME = "//NewDataSet//PUBLIC_MEMBER//MEMBERNAME";
String PUBLIC_MEMBER_ADDCODE = "//NewDataSet//PUBLIC_MEMBER//ADDCODE";
String PUBLIC_MEMBER_TELEPHONE = "//NewDataSet//PUBLIC_MEMBER//TELEPHONE";
String PUBLIC_MEMBER_FAX = "//NewDataSet//PUBLIC_MEMBER//FAX";
String PUBLIC_MEMBER_ZIP = "//NewDataSet//PUBLIC_MEMBER//ZIP";
String PUBLIC_MEMBER_THEADDRESS = "//NewDataSet//PUBLIC_MEMBER//THEADDRESS";
String PUBLIC_MEMBER_EMAIL = "//NewDataSet//PUBLIC_MEMBER//EMAIL";
String PUBLIC_MEMBER_CONTACT = "//NewDataSet//PUBLIC_MEMBER//CONTACT";
String PUBLIC_MEMBER_INFO_MEMBERID = "//NewDataSet//PUBLIC_MEMBER_INFO//MEMBERID";
String PUBLIC_MEMBER_INFO_LICENSEID = "//NewDataSet//PUBLIC_MEMBER_INFO//LICENSEID";
String PUBLIC_MEMBER_INFO_REG_ADDRESS = "//NewDataSet//PUBLIC_MEMBER_INFO//REG_ADDRESS";
String PUBLIC_MEMBER_INFO_DEPUTY = "//NewDataSet//PUBLIC_MEMBER_INFO//DEPUTY";
String PUBLIC_MEMBER_INFO_PRESIDENT = "//NewDataSet//PUBLIC_MEMBER_INFO//PRESIDENT";
String PUBLIC_MEMBER_INFO_QUANLITYPRINCIPAL = "//NewDataSet//PUBLIC_MEMBER_INFO//QUANLITYPRINCIPAL";
String PUBLIC_MEMBER_INFO_SALESMODE = "//NewDataSet//PUBLIC_MEMBER_INFO//SALESMODE";
String PUBLIC_MEMBER_INFO_PUBLICDEPARTMENT = "//NewDataSet//PUBLIC_MEMBER_INFO//PUBLICDEPARTMENT";
String PUBLIC_MEMBER_INFO_PROCESSSPAN = "//NewDataSet//PUBLIC_MEMBER_INFO//PROCESSSPAN";
String COMMODITY_COMMODITYID = "//NewDataSet//COMMODITY//COMMODITYID";
String COMMODITY_PROJECTID = "//NewDataSet//COMMODITY//PROJECTID";
String COMMODITY_TRADENAME = "//NewDataSet//COMMODITY//TRADENAME";
String COMMODITY_DOSE = "//NewDataSet//COMMODITY//DOSE";
String COMMODITY_SPEC = "//NewDataSet//COMMODITY//SPEC";
String COMMODITY_PACKSPEC = "//NewDataSet//COMMODITY//PACKSPEC";
String COMMODITY_UNIT = "//NewDataSet//COMMODITY//UNIT";
String COMMODITY_PRODUCER_MEMBER_ID = "//NewDataSet//COMMODITY//PRODUCER_MEMBER_ID";
String COMMODITY_PNAME = "//NewDataSet//COMMODITY//PNAME";
String COMMODITY_APPROVE_NO = "//NewDataSet//COMMODITY//APPROVE_NO";
String COMMODITY_DRUG_NAME = "//NewDataSet//COMMODITY//DRUG_NAME";
String COMMODITY_DRUG_ID = "//NewDataSet//COMMODITY//DRUG_ID";
String COMMODITY_DRUG_TYPE = "//NewDataSet//COMMODITY//DRUG_TYPE";
String COMMODITY_GMP_TYPE = "//NewDataSet//COMMODITY//GMP_TYPE";
String COMMODITY_GMP_NUMBER = "//NewDataSet//COMMODITY//GMP_NUMBER";
String COMMODITY_GMP_ENDDATE = "//NewDataSet//COMMODITY//GMP_ENDDATE";
String COMMODITY_CONTROLID = "//NewDataSet//COMMODITY//CONTROLID";
String COMMODITY_INNERID = "//NewDataSet//COMMODITY//INNERID";
String COMMODITY_THESTATE = "//NewDataSet//COMMODITY//THESTATE";
String COMMODITY_COMMODITYIDFORTC = "//NewDataSet//COMMODITY//COMMODITYIDFORTC";
String COMMODITY_ISBASECOMM = "//NewDataSet//COMMODITY//ISBASECOMM";
String Product_THEITEMID="//NewDataSet//Product//THEITEMID";
String Product_ADDCODE="//NewDataSet//Product//ADDCODE";
String Product_SENDQUANTITY="//NewDataSet//Product//SENDQUANTITY";
String Product_BATCHTXT="//NewDataSet//Product//BATCHTXT";
String Product_BILLNUMBER="//NewDataSet//Product//BILLNUMBER";
String Product_VALIDITYDATE="//NewDataSet//Product//VALIDITYDATE";
String Product_INVOICENUMBER="//NewDataSet//Product//INVOICENUMBER";
String Product_SENDDATE="//NewDataSet//Product//SENDDATE";
String Product_PROJECTID="//NewDataSet//Product//PROJECTID";
String Product_INNERID="//NewDataSet//Product//INNERID";
String Product_NMEMBERID="//NewDataSet//Product//NMEMBERID";
String Product_SMEMBERID="//NewDataSet//Product//SMEMBERID";
String Product_COMMONDITYID="//NewDataSet//Product//COMMONDITYID";
Intent intent = null;
Commodity mod = null;
SendProduct sp = null;
PublicMember pm = null;
PublicMemberInfo pmi = null;
SendProduct product=null;
StringBuffer currentPath = new StringBuffer();
List list=new ArrayList();
private int size=1000;
// 文档解析开始
public void startDocument() throws SAXException {
System.out.println("开始解析xml文件......");
}
//总计有多少条数据
private long total=0;
String INTENT_INTENTID = "//NewDataSet//INTENT//INTENTID";
String INTENT_ADDCODE = "//NewDataSet//INTENT//ADDCODE";
String INTENT_SENDDATE = "//NewDataSet//INTENT//SENDDATE";
String INTENT_NMEMBERID = "//NewDataSet//INTENT//NMEMBERID";
String INTENT_SMEMBERID = "//NewDataSet//INTENT//SMEMBERID";
String INTENT_THEITEMID = "//NewDataSet//INTENT//THEITEMID";
String INTENT_COMMODITYID = "//NewDataSet//INTENT//COMMODITYID";
String INTENT_BATCH = "//NewDataSet//INTENT//BATCH";
String INTENT_PRICE = "//NewDataSet//INTENT//PRICE";
String INTENT_INNERID = "//NewDataSet//INTENT//INNERID";
String INTENT_PROJECTID = "//NewDataSet//INTENT//PROJECTID";
String SENDPRODUCT_THEITEMID = "//NewDataSet//SENDPRODUCT//THEITEMID";
String SENDPRODUCT_ADDCODE = "//NewDataSet//SENDPRODUCT//ADDCODE";
String SENDPRODUCT_SENDQUANTITY = "//NewDataSet//SENDPRODUCT//SENDQUANTITY";
String SENDPRODUCT_BATCHTXT = "//NewDataSet//SENDPRODUCT//BATCHTXT";
String SENDPRODUCT_BILLNUMBER = "//NewDataSet//SENDPRODUCT//BILLNUMBER";
String SENDPRODUCT_VALIDITYDATE = "//NewDataSet//SENDPRODUCT//VALIDITYDATE";
String SENDPRODUCT_INVOICENUMBER = "//NewDataSet//SENDPRODUCT//INVOICENUMBER";
String SENDPRODUCT_SENDDATE = "//NewDataSet//SENDPRODUCT//SENDDATE";
String SENDPRODUCT_PROJECTID = "//NewDataSet//SENDPRODUCT//PROJECTID";
String SENDPRODUCT_INNERID = "//NewDataSet//SENDPRODUCT//INNERID";
String SENDPRODUCT_NMEMBERID = "//NewDataSet//SENDPRODUCT//NMEMBERID";
String SENDPRODUCT_SMEMBERID = "//NewDataSet//SENDPRODUCT//SMEMBERID";
String SENDPRODUCT_COMMONDITYID = "//NewDataSet//SENDPRODUCT//COMMONDITYID";
String SENDPRODUCT_GUIDCODE = "//NewDataSet//SENDPRODUCT//GUIDCODE";
String PUBLIC_MEMBER_MEMBERID = "//NewDataSet//PUBLIC_MEMBER//MEMBERID";
String PUBLIC_MEMBER_MEMBERCLASSID = "//NewDataSet//PUBLIC_MEMBER//MEMBERCLASSID";
String PUBLIC_MEMBER_MEMBERCLASSNAME = "//NewDataSet//PUBLIC_MEMBER//MEMBERCLASSNAME";
String PUBLIC_MEMBER_MEMBERNAME = "//NewDataSet//PUBLIC_MEMBER//MEMBERNAME";
String PUBLIC_MEMBER_ADDCODE = "//NewDataSet//PUBLIC_MEMBER//ADDCODE";
String PUBLIC_MEMBER_TELEPHONE = "//NewDataSet//PUBLIC_MEMBER//TELEPHONE";
String PUBLIC_MEMBER_FAX = "//NewDataSet//PUBLIC_MEMBER//FAX";
String PUBLIC_MEMBER_ZIP = "//NewDataSet//PUBLIC_MEMBER//ZIP";
String PUBLIC_MEMBER_THEADDRESS = "//NewDataSet//PUBLIC_MEMBER//THEADDRESS";
String PUBLIC_MEMBER_EMAIL = "//NewDataSet//PUBLIC_MEMBER//EMAIL";
String PUBLIC_MEMBER_CONTACT = "//NewDataSet//PUBLIC_MEMBER//CONTACT";
String PUBLIC_MEMBER_INFO_MEMBERID = "//NewDataSet//PUBLIC_MEMBER_INFO//MEMBERID";
String PUBLIC_MEMBER_INFO_LICENSEID = "//NewDataSet//PUBLIC_MEMBER_INFO//LICENSEID";
String PUBLIC_MEMBER_INFO_REG_ADDRESS = "//NewDataSet//PUBLIC_MEMBER_INFO//REG_ADDRESS";
String PUBLIC_MEMBER_INFO_DEPUTY = "//NewDataSet//PUBLIC_MEMBER_INFO//DEPUTY";
String PUBLIC_MEMBER_INFO_PRESIDENT = "//NewDataSet//PUBLIC_MEMBER_INFO//PRESIDENT";
String PUBLIC_MEMBER_INFO_QUANLITYPRINCIPAL = "//NewDataSet//PUBLIC_MEMBER_INFO//QUANLITYPRINCIPAL";
String PUBLIC_MEMBER_INFO_SALESMODE = "//NewDataSet//PUBLIC_MEMBER_INFO//SALESMODE";
String PUBLIC_MEMBER_INFO_PUBLICDEPARTMENT = "//NewDataSet//PUBLIC_MEMBER_INFO//PUBLICDEPARTMENT";
String PUBLIC_MEMBER_INFO_PROCESSSPAN = "//NewDataSet//PUBLIC_MEMBER_INFO//PROCESSSPAN";
String COMMODITY_COMMODITYID = "//NewDataSet//COMMODITY//COMMODITYID";
String COMMODITY_PROJECTID = "//NewDataSet//COMMODITY//PROJECTID";
String COMMODITY_TRADENAME = "//NewDataSet//COMMODITY//TRADENAME";
String COMMODITY_DOSE = "//NewDataSet//COMMODITY//DOSE";
String COMMODITY_SPEC = "//NewDataSet//COMMODITY//SPEC";
String COMMODITY_PACKSPEC = "//NewDataSet//COMMODITY//PACKSPEC";
String COMMODITY_UNIT = "//NewDataSet//COMMODITY//UNIT";
String COMMODITY_PRODUCER_MEMBER_ID = "//NewDataSet//COMMODITY//PRODUCER_MEMBER_ID";
String COMMODITY_PNAME = "//NewDataSet//COMMODITY//PNAME";
String COMMODITY_APPROVE_NO = "//NewDataSet//COMMODITY//APPROVE_NO";
String COMMODITY_DRUG_NAME = "//NewDataSet//COMMODITY//DRUG_NAME";
String COMMODITY_DRUG_ID = "//NewDataSet//COMMODITY//DRUG_ID";
String COMMODITY_DRUG_TYPE = "//NewDataSet//COMMODITY//DRUG_TYPE";
String COMMODITY_GMP_TYPE = "//NewDataSet//COMMODITY//GMP_TYPE";
String COMMODITY_GMP_NUMBER = "//NewDataSet//COMMODITY//GMP_NUMBER";
String COMMODITY_GMP_ENDDATE = "//NewDataSet//COMMODITY//GMP_ENDDATE";
String COMMODITY_CONTROLID = "//NewDataSet//COMMODITY//CONTROLID";
String COMMODITY_INNERID = "//NewDataSet//COMMODITY//INNERID";
String COMMODITY_THESTATE = "//NewDataSet//COMMODITY//THESTATE";
String COMMODITY_COMMODITYIDFORTC = "//NewDataSet//COMMODITY//COMMODITYIDFORTC";
String COMMODITY_ISBASECOMM = "//NewDataSet//COMMODITY//ISBASECOMM";
String Product_THEITEMID="//NewDataSet//Product//THEITEMID";
String Product_ADDCODE="//NewDataSet//Product//ADDCODE";
String Product_SENDQUANTITY="//NewDataSet//Product//SENDQUANTITY";
String Product_BATCHTXT="//NewDataSet//Product//BATCHTXT";
String Product_BILLNUMBER="//NewDataSet//Product//BILLNUMBER";
String Product_VALIDITYDATE="//NewDataSet//Product//VALIDITYDATE";
String Product_INVOICENUMBER="//NewDataSet//Product//INVOICENUMBER";
String Product_SENDDATE="//NewDataSet//Product//SENDDATE";
String Product_PROJECTID="//NewDataSet//Product//PROJECTID";
String Product_INNERID="//NewDataSet//Product//INNERID";
String Product_NMEMBERID="//NewDataSet//Product//NMEMBERID";
String Product_SMEMBERID="//NewDataSet//Product//SMEMBERID";
String Product_COMMONDITYID="//NewDataSet//Product//COMMONDITYID";
Intent intent = null;
Commodity mod = null;
SendProduct sp = null;
PublicMember pm = null;
PublicMemberInfo pmi = null;
SendProduct product=null;
StringBuffer currentPath = new StringBuffer();
List list=new ArrayList();
private int size=1000;
// 文档解析开始
public void startDocument() throws SAXException {
System.out.println("开始解析xml文件......");
}
// 标签解析开始
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
currentPath.append("//"+qName);
System.out.println(currentPath);
if ("INTENT".equals(qName)) {
intent = new Intent();
}
if ("COMMODITY".equals(qName)) {
mod = new Commodity();
}
if ("PUBLIC_MEMBER_INFO".equals(qName)) {
pmi = new PublicMemberInfo();
}
if ("PUBLIC_MEMBER".equals(qName)) {
pm = new PublicMember();
}
if ("SENDPRODUCT".equals(qName)) {
sp = new SendProduct();
}
if ("Product".equals(qName)) {
product = new SendProduct();
}
}
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
currentPath.append("//"+qName);
System.out.println(currentPath);
if ("INTENT".equals(qName)) {
intent = new Intent();
}
if ("COMMODITY".equals(qName)) {
mod = new Commodity();
}
if ("PUBLIC_MEMBER_INFO".equals(qName)) {
pmi = new PublicMemberInfo();
}
if ("PUBLIC_MEMBER".equals(qName)) {
pm = new PublicMember();
}
if ("SENDPRODUCT".equals(qName)) {
sp = new SendProduct();
}
if ("Product".equals(qName)) {
product = new SendProduct();
}
}
// 标签解析结束
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
currentPath
.delete(currentPath.lastIndexOf(qName)-1, currentPath.length());
if ("INTENT".equals(qName)) {
list.add(intent);
intent = null;
}
if ("COMMODITY".equals(qName)) {
list.add(mod);
mod = null;
}
if ("PUBLIC_MEMBER_INFO".equals(qName)) {
list.add(pmi);
pmi = null;
}
if ("PUBLIC_MEMBER".equals(qName)) {
list.add(pm);
pm = null;
}
if ("SENDPRODUCT".equals(qName)) {
list.add(sp);
sp = null;
}
if ("Product".equals(qName)) {
list.add(product);
product = null;
}
if(list.size()>=size){
total+=list.size();
//调用保持统计
System.out.println(">>>>>>>>>处理这以前条数据");
//清空list
list.clear();
System.out.println(">>>>>>>>>>清空list");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
currentPath
.delete(currentPath.lastIndexOf(qName)-1, currentPath.length());
if ("INTENT".equals(qName)) {
list.add(intent);
intent = null;
}
if ("COMMODITY".equals(qName)) {
list.add(mod);
mod = null;
}
if ("PUBLIC_MEMBER_INFO".equals(qName)) {
list.add(pmi);
pmi = null;
}
if ("PUBLIC_MEMBER".equals(qName)) {
list.add(pm);
pm = null;
}
if ("SENDPRODUCT".equals(qName)) {
list.add(sp);
sp = null;
}
if ("Product".equals(qName)) {
list.add(product);
product = null;
}
if(list.size()>=size){
total+=list.size();
//调用保持统计
System.out.println(">>>>>>>>>处理这以前条数据");
//清空list
list.clear();
System.out.println(">>>>>>>>>>清空list");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
// 字符串解析
public void characters(char[] ch, int start, int length) {
if (currentPath.toString().equals(INTENT_INTENTID)) {
intent.setIntendId((intent.getIntendId() != null ? intent
.getIntendId() : "")
+ new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_ADDCODE)) {
intent.setAddCode((intent.getAddCode()!=null?intent.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_SENDDATE)) {
intent.setSendDate((intent.getSendDate()!=null?intent.getSendDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_NMEMBERID)) {
intent.setNmemberId((intent.getNmemberId()!=null?intent.getNmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_SMEMBERID)) {
intent.setSmemberId((intent.getSmemberId()!=null?intent.getSmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_THEITEMID)) {
intent.setItemId((intent.getItemId()!=null?intent.getItemId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_COMMODITYID)) {
intent.setCommodityId((intent.getCommodityId()!=null?intent.getCommodityId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_BATCH)) {
intent.setBatch((intent.getBatch()!=null?intent.getBatch():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_PRICE)) {
intent.setPrice((intent.getPrice()!=null?intent.getPrice():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_INNERID)) {
intent.setInnerId((intent.getInnerId()!=null?intent.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_PROJECTID )) {
intent.setProjectId((intent.getProjectId()!=null?intent.getProjectId():"")+new String(ch, start, length));
}
//sendproject
if (currentPath.toString().equals(SENDPRODUCT_THEITEMID )) {
sp.setItemId((sp.getItemId()!=null?sp.getItemId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_ADDCODE)) {
sp.setAddCode((sp.getAddCode()!=null?sp.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_SENDQUANTITY)) {
sp.setSendQuantity((sp.getSendQuantity()!=null?sp.getSendQuantity():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_BATCHTXT )) {
sp.setBatchTxt((sp.getBatchTxt()!=null?sp.getBatchTxt():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_BILLNUMBER )) {
sp.setBillNumber((sp.getBillNumber()!=null?sp.getBillNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_VALIDITYDATE )) {
sp.setValidityDate((sp.getValidityDate()!=null?sp.getValidityDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_INVOICENUMBER )) {
sp.setInvoiceNumber((sp.getInvoiceNumber()!=null?sp.getInvoiceNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_SENDDATE )) {
sp.setSendDate((sp.getSendDate()!=null?sp.getSendDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_PROJECTID )) {
sp.setProjectId((sp.getProjectId()!=null?sp.getProjectId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_INNERID)) {
sp.setInnerId((sp.getInnerId()!=null?sp.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_NMEMBERID)) {
sp.setNmemberId((sp.getNmemberId()!=null?sp.getNmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_SMEMBERID)) {
sp.setSmemberId((sp.getSmemberId()!=null?sp.getSmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_COMMONDITYID)) {
sp.setCommodityId((sp.getCommodityId()!=null?sp.getCommodityId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_GUIDCODE)) {
sp.setGuidCode((sp.getGuidCode()!=null?sp.getGuidCode():"")+new String(ch, start, length));
}
//PUBLIC_MEMBER
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERID)) {
pm.setMemberId((pm.getMemberId()!=null?pm.getMemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERCLASSID)) {
pm.setMemberClassId((pm.getMemberClassId()!=null?pm.getMemberClassId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERCLASSNAME)) {
pm.setMemberClassName((pm.getMemberClassName()!=null?pm.getMemberClassName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERNAME)) {
pm.setMemberName((pm.getMemberName()!=null?pm.getMemberName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_ADDCODE )) {
pm.setAddCode((pm.getAddCode()!=null?pm.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_TELEPHONE )) {
pm.setTelePhone((pm.getTelePhone()!=null?pm.getTelePhone():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_FAX )) {
pm.setFax((pm.getFax()!=null?pm.getFax():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_ZIP )) {
pm.setZip((pm.getZip()!=null?pm.getZip():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_THEADDRESS )) {
pm.setAddress((pm.getAddress()!=null?pm.getAddress():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_EMAIL )) {
pm.setEmail((pm.getEmail()!=null?pm.getEmail():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_CONTACT )) {
pm.setContact((pm.getContact()!=null?pm.getContact():"")+new String(ch, start, length));
}
//PUBLIC_MEMBER_INFO
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_MEMBERID)) {
pmi.setMemberId((pmi.getMemberId()!=null?pmi.getMemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_LICENSEID )) {
pmi.setLicenseId((pmi.getLicenseId()!=null?pmi.getLicenseId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_REG_ADDRESS )) {
pmi.setRegAddress((pmi.getRegAddress()!=null?pmi.getRegAddress():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_DEPUTY )) {
pmi.setDePuty((pmi.getDePuty()!=null?pmi.getDePuty():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_PRESIDENT )) {
pmi.setPresident((pmi.getPresident()!=null?pmi.getPresident():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_QUANLITYPRINCIPAL )) {
pmi.setQuanlityPrincipal((pmi.getQuanlityPrincipal()!=null?pmi.getQuanlityPrincipal():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_SALESMODE )) {
pmi.setSalesMode((pmi.getSalesMode()!=null?pmi.getSalesMode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_PUBLICDEPARTMENT )) {
pmi.setPublicDepartMent((pmi.getPublicDepartMent()!=null?pmi.getPublicDepartMent():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_PROCESSSPAN )) {
pmi.setProcessSpanStr((pmi.getProcessSpanStr()!=null?pmi.getProcessSpanStr():"")+new String(ch, start, length));
}
//COMMODITY
if (currentPath.toString().equals(COMMODITY_COMMODITYID )) {
mod.setCommodityId((mod.getCommodityId()!=null?mod.getCommodityId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PROJECTID )) {
mod.setProjectId((mod.getProjectId()!=null?mod.getProjectId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_TRADENAME )) {
mod.setTradeName((mod.getTradeName()!=null?mod.getTradeName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DOSE )) {
mod.setDose((mod.getDose()!=null?mod.getDose():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_SPEC )) {
mod.setSpec((mod.getSpec()!=null?mod.getSpec():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PACKSPEC )) {
mod.setPackSpec((mod.getPackSpec()!=null?mod.getPackSpec():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_UNIT )) {
mod.setUnit((mod.getUnit()!=null?mod.getUnit():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PRODUCER_MEMBER_ID )) {
mod.setProducerMemberId((mod.getProducerMemberId()!=null?mod.getProducerMemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PNAME )) {
mod.setPname((mod.getPname()!=null?mod.getPname():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_APPROVE_NO )) {
mod.setApproveNo((mod.getApproveNo()!=null?mod.getApproveNo():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DRUG_NAME )) {
mod.setDrugName((mod.getDrugName()!=null?mod.getDrugName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DRUG_ID )) {
mod.setDrugId((mod.getDrugId()!=null?mod.getDrugId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DRUG_TYPE )) {
mod.setDrugType((mod.getDrugType()!=null?mod.getDrugType():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_GMP_TYPE )) {
mod.setGmpType((mod.getGmpType()!=null?mod.getGmpType():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_GMP_NUMBER )) {
mod.setGmpNumber((mod.getGmpNumber()!=null?mod.getGmpNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_GMP_ENDDATE )) {
mod.setGmpEndDate((mod.getGmpEndDate()!=null?mod.getGmpEndDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_CONTROLID )) {
mod.setControlId((mod.getControlId()!=null?mod.getControlId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_INNERID )) {
mod.setInnerId((mod.getInnerId()!=null?mod.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_THESTATE )) {
mod.setState((mod.getState()!=null?mod.getState():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_COMMODITYIDFORTC )) {
mod.setCommodityIdForTc((mod.getCommodityIdForTc()!=null?mod.getCommodityIdForTc():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_ISBASECOMM )) {
mod.setIsBaseComm((mod.getIsBaseComm()!=null?mod.getIsBaseComm():"")+new String(ch, start, length));
}
//PRODUCT
if (currentPath.toString().equals(Product_THEITEMID )) {
product.setItemId((product.getItemId()!=null?product.getItemId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_ADDCODE )) {
product.setAddCode((product.getAddCode()!=null?product.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_SENDQUANTITY )) {
product.setSendQuantity((product.getSendQuantity()!=null?product.getSendQuantity():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_BATCHTXT )) {
product.setBatchTxt((product.getBatchTxt()!=null?product.getBatchTxt():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_BILLNUMBER )) {
product.setBillNumber((product.getBillNumber()!=null?product.getBillNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_VALIDITYDATE )) {
product.setValidityDate((product.getValidityDate()!=null?product.getValidityDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_INVOICENUMBER )) {
product.setInvoiceNumber((product.getInvoiceNumber()!=null?product.getInvoiceNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_SENDDATE )) {
product.setSendDate((product.getSendDate()!=null?product.getSendDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_PROJECTID )) {
product.setProjectId((product.getProjectId()!=null?product.getProjectId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_INNERID )) {
product.setInnerId((product.getInnerId()!=null?product.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_NMEMBERID)) {
product.setNmemberId((product.getNmemberId()!=null?product.getNmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_SMEMBERID)) {
product.setSmemberId((product.getSmemberId()!=null?product.getSmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_COMMONDITYID)) {
product.setCommodityId((product.getCommodityId()!=null?product.getCommodityId():"")+new String(ch, start, length));
}
}
public void characters(char[] ch, int start, int length) {
if (currentPath.toString().equals(INTENT_INTENTID)) {
intent.setIntendId((intent.getIntendId() != null ? intent
.getIntendId() : "")
+ new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_ADDCODE)) {
intent.setAddCode((intent.getAddCode()!=null?intent.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_SENDDATE)) {
intent.setSendDate((intent.getSendDate()!=null?intent.getSendDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_NMEMBERID)) {
intent.setNmemberId((intent.getNmemberId()!=null?intent.getNmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_SMEMBERID)) {
intent.setSmemberId((intent.getSmemberId()!=null?intent.getSmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_THEITEMID)) {
intent.setItemId((intent.getItemId()!=null?intent.getItemId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_COMMODITYID)) {
intent.setCommodityId((intent.getCommodityId()!=null?intent.getCommodityId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_BATCH)) {
intent.setBatch((intent.getBatch()!=null?intent.getBatch():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_PRICE)) {
intent.setPrice((intent.getPrice()!=null?intent.getPrice():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_INNERID)) {
intent.setInnerId((intent.getInnerId()!=null?intent.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(INTENT_PROJECTID )) {
intent.setProjectId((intent.getProjectId()!=null?intent.getProjectId():"")+new String(ch, start, length));
}
//sendproject
if (currentPath.toString().equals(SENDPRODUCT_THEITEMID )) {
sp.setItemId((sp.getItemId()!=null?sp.getItemId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_ADDCODE)) {
sp.setAddCode((sp.getAddCode()!=null?sp.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_SENDQUANTITY)) {
sp.setSendQuantity((sp.getSendQuantity()!=null?sp.getSendQuantity():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_BATCHTXT )) {
sp.setBatchTxt((sp.getBatchTxt()!=null?sp.getBatchTxt():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_BILLNUMBER )) {
sp.setBillNumber((sp.getBillNumber()!=null?sp.getBillNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_VALIDITYDATE )) {
sp.setValidityDate((sp.getValidityDate()!=null?sp.getValidityDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_INVOICENUMBER )) {
sp.setInvoiceNumber((sp.getInvoiceNumber()!=null?sp.getInvoiceNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_SENDDATE )) {
sp.setSendDate((sp.getSendDate()!=null?sp.getSendDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_PROJECTID )) {
sp.setProjectId((sp.getProjectId()!=null?sp.getProjectId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_INNERID)) {
sp.setInnerId((sp.getInnerId()!=null?sp.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_NMEMBERID)) {
sp.setNmemberId((sp.getNmemberId()!=null?sp.getNmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_SMEMBERID)) {
sp.setSmemberId((sp.getSmemberId()!=null?sp.getSmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_COMMONDITYID)) {
sp.setCommodityId((sp.getCommodityId()!=null?sp.getCommodityId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(SENDPRODUCT_GUIDCODE)) {
sp.setGuidCode((sp.getGuidCode()!=null?sp.getGuidCode():"")+new String(ch, start, length));
}
//PUBLIC_MEMBER
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERID)) {
pm.setMemberId((pm.getMemberId()!=null?pm.getMemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERCLASSID)) {
pm.setMemberClassId((pm.getMemberClassId()!=null?pm.getMemberClassId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERCLASSNAME)) {
pm.setMemberClassName((pm.getMemberClassName()!=null?pm.getMemberClassName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_MEMBERNAME)) {
pm.setMemberName((pm.getMemberName()!=null?pm.getMemberName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_ADDCODE )) {
pm.setAddCode((pm.getAddCode()!=null?pm.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_TELEPHONE )) {
pm.setTelePhone((pm.getTelePhone()!=null?pm.getTelePhone():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_FAX )) {
pm.setFax((pm.getFax()!=null?pm.getFax():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_ZIP )) {
pm.setZip((pm.getZip()!=null?pm.getZip():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_THEADDRESS )) {
pm.setAddress((pm.getAddress()!=null?pm.getAddress():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_EMAIL )) {
pm.setEmail((pm.getEmail()!=null?pm.getEmail():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_CONTACT )) {
pm.setContact((pm.getContact()!=null?pm.getContact():"")+new String(ch, start, length));
}
//PUBLIC_MEMBER_INFO
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_MEMBERID)) {
pmi.setMemberId((pmi.getMemberId()!=null?pmi.getMemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_LICENSEID )) {
pmi.setLicenseId((pmi.getLicenseId()!=null?pmi.getLicenseId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_REG_ADDRESS )) {
pmi.setRegAddress((pmi.getRegAddress()!=null?pmi.getRegAddress():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_DEPUTY )) {
pmi.setDePuty((pmi.getDePuty()!=null?pmi.getDePuty():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_PRESIDENT )) {
pmi.setPresident((pmi.getPresident()!=null?pmi.getPresident():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_QUANLITYPRINCIPAL )) {
pmi.setQuanlityPrincipal((pmi.getQuanlityPrincipal()!=null?pmi.getQuanlityPrincipal():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_SALESMODE )) {
pmi.setSalesMode((pmi.getSalesMode()!=null?pmi.getSalesMode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_PUBLICDEPARTMENT )) {
pmi.setPublicDepartMent((pmi.getPublicDepartMent()!=null?pmi.getPublicDepartMent():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(PUBLIC_MEMBER_INFO_PROCESSSPAN )) {
pmi.setProcessSpanStr((pmi.getProcessSpanStr()!=null?pmi.getProcessSpanStr():"")+new String(ch, start, length));
}
//COMMODITY
if (currentPath.toString().equals(COMMODITY_COMMODITYID )) {
mod.setCommodityId((mod.getCommodityId()!=null?mod.getCommodityId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PROJECTID )) {
mod.setProjectId((mod.getProjectId()!=null?mod.getProjectId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_TRADENAME )) {
mod.setTradeName((mod.getTradeName()!=null?mod.getTradeName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DOSE )) {
mod.setDose((mod.getDose()!=null?mod.getDose():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_SPEC )) {
mod.setSpec((mod.getSpec()!=null?mod.getSpec():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PACKSPEC )) {
mod.setPackSpec((mod.getPackSpec()!=null?mod.getPackSpec():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_UNIT )) {
mod.setUnit((mod.getUnit()!=null?mod.getUnit():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PRODUCER_MEMBER_ID )) {
mod.setProducerMemberId((mod.getProducerMemberId()!=null?mod.getProducerMemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_PNAME )) {
mod.setPname((mod.getPname()!=null?mod.getPname():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_APPROVE_NO )) {
mod.setApproveNo((mod.getApproveNo()!=null?mod.getApproveNo():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DRUG_NAME )) {
mod.setDrugName((mod.getDrugName()!=null?mod.getDrugName():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DRUG_ID )) {
mod.setDrugId((mod.getDrugId()!=null?mod.getDrugId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_DRUG_TYPE )) {
mod.setDrugType((mod.getDrugType()!=null?mod.getDrugType():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_GMP_TYPE )) {
mod.setGmpType((mod.getGmpType()!=null?mod.getGmpType():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_GMP_NUMBER )) {
mod.setGmpNumber((mod.getGmpNumber()!=null?mod.getGmpNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_GMP_ENDDATE )) {
mod.setGmpEndDate((mod.getGmpEndDate()!=null?mod.getGmpEndDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_CONTROLID )) {
mod.setControlId((mod.getControlId()!=null?mod.getControlId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_INNERID )) {
mod.setInnerId((mod.getInnerId()!=null?mod.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_THESTATE )) {
mod.setState((mod.getState()!=null?mod.getState():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_COMMODITYIDFORTC )) {
mod.setCommodityIdForTc((mod.getCommodityIdForTc()!=null?mod.getCommodityIdForTc():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(COMMODITY_ISBASECOMM )) {
mod.setIsBaseComm((mod.getIsBaseComm()!=null?mod.getIsBaseComm():"")+new String(ch, start, length));
}
//PRODUCT
if (currentPath.toString().equals(Product_THEITEMID )) {
product.setItemId((product.getItemId()!=null?product.getItemId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_ADDCODE )) {
product.setAddCode((product.getAddCode()!=null?product.getAddCode():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_SENDQUANTITY )) {
product.setSendQuantity((product.getSendQuantity()!=null?product.getSendQuantity():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_BATCHTXT )) {
product.setBatchTxt((product.getBatchTxt()!=null?product.getBatchTxt():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_BILLNUMBER )) {
product.setBillNumber((product.getBillNumber()!=null?product.getBillNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_VALIDITYDATE )) {
product.setValidityDate((product.getValidityDate()!=null?product.getValidityDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_INVOICENUMBER )) {
product.setInvoiceNumber((product.getInvoiceNumber()!=null?product.getInvoiceNumber():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_SENDDATE )) {
product.setSendDate((product.getSendDate()!=null?product.getSendDate():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_PROJECTID )) {
product.setProjectId((product.getProjectId()!=null?product.getProjectId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_INNERID )) {
product.setInnerId((product.getInnerId()!=null?product.getInnerId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_NMEMBERID)) {
product.setNmemberId((product.getNmemberId()!=null?product.getNmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_SMEMBERID)) {
product.setSmemberId((product.getSmemberId()!=null?product.getSmemberId():"")+new String(ch, start, length));
}
if (currentPath.toString().equals(Product_COMMONDITYID)) {
product.setCommodityId((product.getCommodityId()!=null?product.getCommodityId():"")+new String(ch, start, length));
}
}
// 文档解析结束
public void endDocument() throws SAXException {
System.out.println("解析xml文件结束!/n");
}
public void endDocument() throws SAXException {
System.out.println("解析xml文件结束!/n");
}
public static void main(String[] args) {
long d=new Date().getTime();
SaxXmlUtil sax=new SaxXmlUtil();
//生成SAX解析器工厂
SAXParserFactory spf = SAXParserFactory.newInstance();
XMLReader xmlReader = null;
SAXParser saxParser=null;
String filename="d:/train.xml";
try {
// 创建一个解析器SAXParser对象
saxParser = spf.newSAXParser();
// 得到SAXParser中封装的SAX XMLReader
xmlReader = saxParser.getXMLReader();
//设置解析时处理事件的对象
xmlReader.setContentHandler(sax);
//开始解析XML文件
xmlReader.parse(filename);
System.out.println("最后剩余的数据:"+sax.list.size());
System.out.println("总计处理的数据:"+sax.total);
long d1=new Date().getTime();
System.out.println("用时:"+(d1-d));
}catch (Exception ex) {
System.out.println(ex);
}
//输出解析结果
long d=new Date().getTime();
SaxXmlUtil sax=new SaxXmlUtil();
//生成SAX解析器工厂
SAXParserFactory spf = SAXParserFactory.newInstance();
XMLReader xmlReader = null;
SAXParser saxParser=null;
String filename="d:/train.xml";
try {
// 创建一个解析器SAXParser对象
saxParser = spf.newSAXParser();
// 得到SAXParser中封装的SAX XMLReader
xmlReader = saxParser.getXMLReader();
//设置解析时处理事件的对象
xmlReader.setContentHandler(sax);
//开始解析XML文件
xmlReader.parse(filename);
System.out.println("最后剩余的数据:"+sax.list.size());
System.out.println("总计处理的数据:"+sax.total);
long d1=new Date().getTime();
System.out.println("用时:"+(d1-d));
}catch (Exception ex) {
System.out.println(ex);
}
//输出解析结果
}
}
更多推荐
已为社区贡献11条内容
所有评论(0)