关于XML解析的概念

ladofwind 2006-04-10 01:52:40
正学xml方面的东西,我看了网上说java操作XML用到
DOM,SAX,JDOM,Crimzon,Xerce,JAXP,DOM4J.....有些晕,

这些都是什么啊,有什么区别啊?我看jdk自带的包不也可以读写
XML文件吗?另外解析器是什么意思?jdk自带的用的是什么解析器,
上面那些呢?高手多指点,详细些狂送分
...全文
304 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ladofwind 2006-04-10
  • 打赏
  • 举报
回复
上面意思说jdk自带的包是用crimson做解析器的?
怎么看出一段解析XML的java程序到底是用什么解析的呢?
pdvv 2006-04-10
  • 打赏
  • 举报
回复
DOM,SAX,JDOM,Crimzon,Xerce,JAXP,DOM4J.....

先大概归个类:
解析器---Crimson、Xerces、JDOM、DOM4J
解析方式--Sax、dom
规范----JAXP

JAXP定义了一种接口,它规定了两种解析XML文件的方式:SAX和DOM,DOM将xml文件的内容一次性读入内存中再进行操作,而sax按树型结构遍历xml文件。JAXP并没有规定具体使用哪种解析器,只要是按照JAXP规范实现的代码,可以替换底层的解析器。
Crimson和Xerces都是解析器,分别由Sun和IBM捐赠给Apache,但是似乎Xerces应用比较广泛,而Sun的JDK1.4默认是使用自带Crimson的,如果要替换需要手工作配置。W3C的DOM设计是一个复杂公用的,为了在java环境中更好的使用,JDOM产生了,它是由java实现,更容易使用。DOM4J最初也是从JDOM中分离出来的,支持DOM、SAX、JAXP,支持XPath,在IBM网上有一篇XML的评测文章,最终结果是dom4j总体上胜出。所以,dom4j的应用前景应该很乐观。
cuiyingfeng 2006-04-10
  • 打赏
  • 举报
回复
DOM,SAX是解析XML的两种方式;
DOM将整个XML文件解析成一个树结构读到内存中,占用资源大,但是做数据存储时比较好用,随用随取;
SAM是在解析XML文件的时候,进行调用,不占用资源,可做为各种服务器读取配置文件的首选方式;

其他的那些,应该是一些有关XML解析的项目名称,以上两种解析方式可能都支持,你喜欢哪个就用哪个好了,应该没什么区别。
yuzl32 2006-04-10
  • 打赏
  • 举报
回复
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/TOC.html
蒋晟 2006-04-10
  • 打赏
  • 举报
回复
Document Object Model (DOM) is a description of how an HTML or XML document is represented in an object-oriented fashion. DOM provides an application programming interface to access and modify the content, structure and style of the document.
http://www.w3.org/DOM/

SAX is a serial access parser API for XML. SAX provides a mechanism for reading data from an XML document. It is a popular alternative to the Document Object Model (DOM). The name is acronymically derived from "Simple API for XML".
http://www.saxproject.org/

Java Document Object Model (JDOM) is a Java-based document object model for XML that integrates with Document Object Model (DOM) and Simple API for XML (SAX) and uses parsers to build the document. It was designed specifically for the Java platform so that it can take advantage of its language features. JDOM was developed under the Java Community Process as JSR 102. The name JDOM is a pseudo-acronym.
http://www.jdom.org/

Crimson is a Java XML parser which supports XML 1.0
http://xml.apache.org/crimson/

Xerces is a family of software packages for parsing and manipulating XML, part of the Apache XML project. Xerces (named after the Xerces Blue butterfly) provides world-class XML parsing and generation.
http://xml.apache.org/

The Java API for XML Processing, or JAXP, is one of the Java XML programming APIs. It provides the capability of validating and parsing XML documents. The two basic parsing interfaces are:

the Document Object Model parsing interface or DOM interface
the Simple API for XML parsing interface or SAX interface
http://java.sun.com/webservices/jaxp/

dom4j open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP.
http://dom4j.org/

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧