The SAX and DOM APIs are defined by the XML-DEV group and by the W3C, respectively. The libraries that define those APIs are as follows:

  • javax.xml.parsers: The JAXP APIs, which provide a common interface for different vendors' SAX and DOM parsers.

  • org.w3c.dom: Defines the Document class (a DOM) as well as classes for all the components of a DOM.

  • org.xml.sax: Defines the basic SAX APIs.

  • javax.xml.transform: Defines the XSLT APIs that let you transform XML into other forms.

  • javax.xml.stream: Provides StAX-specific transformation APIs.

The Simple API for XML (SAX) is the event-driven, serial-access mechanism that does element-by-element processing. The API for this level reads and writes XML to a data repository or the web. For server-side and high-performance applications, you will want to fully understand this level. But for many applications, a minimal understanding will suffice.

The DOM API is generally an easier API to use. It provides a familiar tree structure of objects. You can use the DOM API to manipulate the hierarchy of application objects it encapsulates. The DOM API is ideal for interactive applications because the entire object model is present in memory, where it can be accessed and manipulated by the user.

On the other hand, constructing the DOM requires reading the entire XML structure and holding the object tree in memory, so it is much more CPU- and memory-intensive. For that reason, the SAX API tends to be preferred for server-side applications and data filters that do not require an in-memory representation of the data.

The XSLT APIs defined in javax.xml.transform let you write XML data to a file or convert it into other forms. As shown in the XSLT section of this tutorial, you can even use it in conjunction with the SAX APIs to convert legacy data to XML.

Finally, the StAX APIs defined in javax.xml.stream provide a streaming Java technology-based, event-driven, pull-parsing API for reading and writing XML documents. StAX offers a simpler programming model than SAX and more efficient memory management than DOM.

最新文章

  1. 几个常用的Linux命令
  2. js => ES6一个新的函数写法
  3. [WPF系列]-ListBox
  4. WCF MSMQ消息队列与离线操作
  5. nginx+tomcat集群配置(1)---根目录设定和多后端分发配置
  6. java thread类和runable
  7. php中的require() 语句的使用方法
  8. .NET(C#)调用webService获取客户端IP地址所属区域(非异步)
  9. A Good Beginning Helps To Make A Good End
  10. weblogic8.1在myeclipse中启动正常,在单独的weblogic中无法正常启动的解决方案.
  11. Android Studio设置自己主动编project
  12. Linux命令学习-useradd和usermod
  13. chromium blog
  14. [SDOI2017]苹果树
  15. tp5 整合 个推
  16. 精读JavaScript模式(七),命名空间模式,私有成员与静态成员
  17. 数据库启动失败:The server quit without updating PID file
  18. Ubuntu 16.04LTS安装Nginx
  19. 【错误记录】记录蛋疼的 mysql 错误
  20. Linux下安装配置Redis

热门文章

  1. jquery放大镜插件与样式
  2. HTML实体
  3. 什么是php?以及mysqlnd与libmysqlclient
  4. 怎样清除td和input之间空隙
  5. poco异步等待ActiveResult
  6. Android WebView缓存分析
  7. 用19种编程语言写Hello World
  8. 二师兄VPN加速器
  9. csu 10月 月赛 B 题 Scoop water
  10. 断命windows上卸载node并重装