Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
Java下XML编程接口比较:DOM SAX JDOM JAXP
leafwinder
follow
0
6-2-2007 1:09 AM
507 views
tags:
java
,
xml
,
dom
,
sax
leafwinder
says:
very basic summary knowledge
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Related Clips
Volcanoes: Nature's Way of Letting Off Ste...
The natural history of Carolina, Florida a...
Disturbing new trend, bloatware on phones
A "Bad" Habit That Helps You Live Longer?
Coffee Quotes
Climate change refugees to be resettled in...
Java Lovers: Starbucks has a Freebie for You
More clips from
leafwinder
The top 100 Webware sites for 2007
Can you read these watches?
Mighty Illusion - Whos Helping Whom??
Today's Top Clips
Sun + Water = Fuel
Weather Balloons To Control Climate
Nano Superbug-Killers -Identifies Bacteria That Have Become Resistant to Antibiotics
Photos Taken At Just the Right Angle
Obama names pro-net-neutrality FCC reviewers
Swapped bodies Experiment
Mind, body and goal: the embodied cognition revolution
The dance of consciousness
Hillary Clinton to accept Obama's offer
Back-to-School Season for Your Immune Cells
visit the
Top Clips page
View the Top Clips from
June 2, 2007
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://www.clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/efdda600-ff7c-4fca-85dc-35fced9aefda/D77A7C02-6A69-4241-B9DF-0D885FCA26DC/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://www.tianyablog.com/blogger/post_show.asp?BlogID=242479&PostID=8269848" href="http://www.tianyablog.com/blogger/post_show.asp?BlogID=242479&PostID=8269848" style="font-size: 11px;">www.tianyablog.com</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.tianyablog.com/blogger/post_show.asp?BlogID=242479&PostID=8269848">一、DOM (文档对象模型)<BR /> 为 XML 文档的已解析版本定义了一组接口。解析器读入整个文档,然后构建一个驻留内存的树结构,然后代码就可以使用 DOM 接口来操作这个树结构。<BR /> 优点:整个文档树在内存中,便于操作;支持删除、修改、重新排列等多种功能;<BR /> 缺点:将整个文档调入内存(包括无用的节点),浪费时间和空间;<BR /> 使用场合:一旦解析了文档还需多次访问这些数据;<BR /><DIV> 硬件资源充足(内存、CPU)</DIV> <BR /> 二、SAX<BR /> 为解决DOM的问题,出现了SAX。<BR /> SAX ,事件驱动。当解析器发现元素开始、元素结束、文本、文档的开始或结束等时,发送事件,程序员编写响应这些事件的代码,保存数据。<BR /> 优点:不用事先调入整个文档,占用资源少;<BR /> SAX解析器代码比DOM解析器代码小,适于Applet,下载<BR /> 缺点:不是持久的;事件过后,若没保存数据,那么数据就丢了;<BR /> 无状态性;从事件中只能得到文本,但不知该文本属于哪个元素;<BR /> 使用场合:Applet;<BR /> 只需XML文档的少量内容,很少回头访问;<BR /><DIV> 机器内存少;</DIV> <BR /> 三、JDOM <BR /> 为减少DOM、SAX的编码量,出现了JDOM;<BR /> 优点:20-80原则,极大减少了代码量<BR /> 使用场合:要实现的功能简单,如解析、创建等<BR /><DIV> Java程序</DIV> <BR /><DIV> 但在底层,JDOM还是使用SAX(最常用)、DOM、Xanan</DIV> <BR /> 四、JAPX<BR /> 为多个XML解析器提供了统一编程接口<BR /> 更换解析器,不用更改代码<BR /> 使用场合:若不用Jdom,一般建议使用JAPX,将代码与各种解析器的实现细节隔离。</blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/D77A7C02-6A69-4241-B9DF-0D885FCA26DC/blog/" title="blog or email this clip"><img src="http://content9.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Blog
Copyright
Privacy
EULA
OK