码迷,mamicode.com
首页 > 编程语言 > 详细

About Java XMLEventReader

时间:2014-10-30 01:37:46      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:http   ar   java   for   on   art   html   amp   ad   

Recently I‘m dealing with a source code data mining project, and I have to use XML in it. But something confusing happens to me. So I searched on Google and finally it got clear.

In this project, I use Event Iterator API of Streaming API for XML (StaX) to parse the XML files. I found a wonderful tutorial here. It really helped me a lot, thanks Lars.

But there is one thing the tutorial missed. Since XMLEventReader works as streaming, it cannot get all data from a event by only reading once. For example, when the content of a node (data between a start element and an end element) contains &lt; or &gt; (tagged by SAX, ‘<‘ and ‘>‘ originally), by calling event.asCharacters().getData(), only characters before these two are fetched. If you want to get them all, a loop should be used here.

About Java XMLEventReader

标签:http   ar   java   for   on   art   html   amp   ad   

原文地址:http://www.cnblogs.com/zhhailon/p/4060947.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!