大致步骤:

1、Java bean

2、DBHelper.java

3、重写DefaultHandler中的方法:MyHander.java

4、循环写数据库:SAXParserDemo.java

 

①xml文件:(要把第二行dtd的绑定删掉)

Java中实现SAX解析xml文件到MySQL数据库
 1 <?xml version="1.0"  encoding="utf-8" ?>
 2 <!DOCTYPE dblp SYSTEM "dblp.dtd">
 3 <dblp>
 4 
 5 <article mdate="2017-05-11" key="journals/ijtm/LuMW10">
 6     <author>Iuan-Yuan Lu</author>
 7     <author>Chih-Jen Mao</author>
 8     <author>Chun-Hsien Wang</author>
 9     <title>Intrafirm technology and knowledge transfer: a best practice perspective.</title>
10     <pages>338-356</pages>
11     <year>2010</year>
12     <volume>49</volume>
13     <journal>IJTM</journal>
14     <number>4</number>
15     <ee>https://doi.org/10.1504/IJTM.2010.030162</ee>
16     <url>db/journals/ijtm/ijtm49.html#LuMW10</url>
17 </article>
18 
19 <article mdate="2017-05-11" key="journals/ijtm/TingTH14">
20 <author>Kuo-Chang Ting</author>
21 <author>Ping Ho Ting</author>
22 <author>Po-Wen Hsiao</author>
23 <title>Why are bloggers willing to share their thoughts via travel blogs?</title>
24 <pages>89-108</pages>
25 <year>2014</year>
26 <volume>64</volume>
27 <journal>IJTM</journal>
28 <number>1</number>
29 <ee>https://doi.org/10.1504/IJTM.2014.059237</ee>
30 <url>db/journals/ijtm/ijtm64.html#TingTH14</url>
31 </article>
32 
33 <article mdate="2017-05-11" key="journals/ijtm/Howells00">
34     <author>Jeremy Howells</author>
35     <title>International coordination of technology flows and knowledge activity in innovation.</title>
36     <pages>806-819</pages>
37     <year>2000</year>
38     <volume>19</volume>
39     <journal>IJTM</journal>
40     <number>7/8</number>
41 </article>
42 </dblp>
dblp.xml

相关文章:

  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2021-07-24
  • 2021-07-06
  • 2021-09-05
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2021-08-27
  • 2021-06-21
  • 2021-10-13
  • 2022-01-16
  • 2022-12-23
  • 2021-08-26
相关资源
相似解决方案