Java API for XML Processing

The Java API for XML Processing (JAXP) is for processing XML data using applications written in the Java programming language

这部分内容主要提纲挈领的讲讲JAXP,讲讲他的几个重要部分,基本的工作原理,还有重要的api。
这是几个重要的工厂
SAXParserFactory, DocumentBuilderFactory, and TransformerFactory--which give you a SAXParser, a DocumentBuilder, and an XSLT transformer
The factory APIs let you plug in an XML implementation offered by another vendor without changing your source code. 是这些工厂的重要之处。
 
几个重要的包:
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
 
SAX APIs
SAXParserFactory:用来获取一个Parser实例的。

SAXParser:定义了几个parser()函数,需要传入XML Source和handler的对象。

SAXReader:SAXParser wraps SAXReader(需要看看)

DefaultHandler,ContentHandler,ErrorHandler,DTDHandler ,EntityResolver

重要的package:
org.xml.sax:
org.xml.sax.ext
org.xml.sax.helpers

DOM APIs
通过DocumentBuilderFactory 获得一个DocumentBuilder的实例,再通过DocumentBuilder的实例来获得.Document的对象。
org.w3c.dom:
javax.xml.parsers :Defines the DocumentBuilderFactory class and the DocumentBuilder class, which returns an object that implements the W3C Document interface.
 
XSLT APIs

A source object can be created from a SAX reader, from a DOM, or from an input stream. Similarly, the result object is the result of the transformation process. That object can be a SAX event handler, a DOM, or an output stream.

javax.xml.transform: Defines the TransformerFactory and Transformer classes
javax.xml.transform.dom:
javax.xml.transform.sax:
javax.xml.transform.stream :

javax.xml.parsers : Defines the SAXParserFactory class, which returns the SAXParser. Also defines exception classes for reporting errors.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值