首页 | 官方网站   微博 | 高级检索  
     

基于StAX中事件迭代器API的XML数据解析技术研究
引用本文:刘雨潇,冒东奎.基于StAX中事件迭代器API的XML数据解析技术研究[J].现代电子技术,2008,31(10):103-105.
作者姓名:刘雨潇  冒东奎
作者单位:北方民族大学,计算机科学与工程学院,宁夏,银川,750021
摘    要:当今许多企业多数使用DOM(文档对象模型)和SAX(XML的简单API)处理XML数据。DOM的主要缺点是在XML文档被导航之前必须在内存里建立其完整的树形结构。为此,处理XML大文档需要消耗大量内存。而SAX的主要缺点在于应用程序被动地接收解析器生成的事件,因此不能通过导航随意浏览和修改XML文档的指定部分。Java EE 5新推出的StAX(Streaming API for XML,XML流式API)很好地解决了上述问题。StAX既有SAX的效率,又有DOM强大的功能。介绍StAX这种最新XML数据解析技术的开发背景,分析其解析机理和技术内涵,并在此基础之上给出一个使用基于事件迭代器的API集合解析XML文件的应用示例。实际操作表明StAX为流式处理XML提供了一个标准、双向模式的解析器接口,比StAX更简单,比DOM管理内存更有效。

关 键 词:StAX  XML  XML解析  DOM
文章编号:1004-373X(2008)10-103-03
修稿时间:2008年1月11日

Study of XML Parsing Technique Based on StAX Iterator API
LIU Yuxiao,MAO Dongkui.Study of XML Parsing Technique Based on StAX Iterator API[J].Modern Electronic Technique,2008,31(10):103-105.
Authors:LIU Yuxiao  MAO Dongkui
Abstract:Nowadays,DOM and SAX are used for XML data processing in most enterprises.The main disadvantage is that an entire tree structure of a XML document must be created in the memory before it can be navigated.Consumption of a huge memory is needed for processing a big XML document.The Shortcoming of SAX is that applications passively receive the generated events by a parser.As a result,browsing and dealing with specified parts of a XML document are impossible.StAX(Streaming API for XML) introduced by Java EE 5 gives a good answer.StAX has the same efficiency as SAX,as well as the same powerful function as DOM.The development background of StAX,a latest parsing technique for XML data.is covered.The parsing mechanics and technical meaning are analyzed.On this basis,an application example for parsing XML document is given,which uses the StAX API based on the iterator.The practice proves that StAX provided a typical and dual interface for XML,it is more similiar and efficiency than SAX and DOM.
Keywords:StAX  XML  XML parsing  DOM
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司    京ICP备09084417号-23

京公网安备 11010802026262号