<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    gembin

    OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

    HBase, Hadoop, ZooKeeper, Cassandra

    Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

    There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

    About Me

     

    SAX vs. DOM

    While comparing two entities, we tend to see both of them as competitors and consequently comparing them to find a winner. This of course is not applicable in every case - not at least in the case of SAX and DOM. Both have their own pros and cons and they are certainly not in direct competition with each other.

    SAX vs. DOM

    Main differences between SAX and DOM, which are the two most popular APIs for processing XML documents in Java, are:-
    • Read v/s Read/Write: SAX can be used only for reading XML documents and not for the manipulation of the underlying XML data whereas DOM can be used for both read and write of the data in an XML document.
    • Sequential Access v/s Random Access: SAX can be used only for a sequential processing of an XML document whereas DOM can be used for a random processing of XML docs. So what to do if you want a random access to the underlying XML data while using SAX? You got to store and manage that information so that you can retrieve it when you need.
    • Call back v/s Tree: SAX uses call back mechanism and uses event-streams to read chunks of XML data into the memory in a sequential manner whereas DOM uses a tree representation of the underlying XML document and facilitates random access/manipulation of the underlying XML data.
    • XML-Dev mailing list v/s W3C: SAX was developed by the XML-Dev mailing list whereas DOM was developed by W3C (World Wide Web Consortium).
    • Information Set: SAX doesn't retain all the info of the underlying XML document such as comments whereas DOM retains almost all the info. New versions of SAX are trying to extend their coverage of information.
    Usual Misconceptions
    • SAX is always faster: this is a very common misunderstanding and one should be aware that SAX may not always be faster because it might not enjoy the storage-size advantage in every case due to the cost of call backs depending upon the particular situation, SAX is being used in.
    • DOM always keeps the whole XML doc in memory: it's not always true. DOM implementations not only vary in their code size and performance, but also in their memory requirements and few of them don't keep the entire XML doc in memory all the time. Otherwise, processing/manipulation of very large XML docs may virtually become impossible using DOM, which is of course not the case.

    How to choose one between the two?

    It primarily depends upon the requirement. If the underlying XML data requires manipulation then almost always DOM will be used as SAX doesn't allow that. Similarly if the nature of access is random (for example, if you need contextual info at every stage) then DOM will be the way to go in most of the cases. But, if the XML document is only required to be read and that too sequentially, then SAX will probably be a better alternative in most of the cases. SAX was developed mainly for pasring XML documents and it's certainly good at it. SO, if you need to process an XML document maybe to update a datasource, SAX will probably make a alternative.
    Requirements may certainly fall between the two extremes discussed above and for any such situation you should weight both the alternatives before picking any of the two. There are applications where a combination of both SAX and DOM are used for XML processing so that might also be an alternative in your case. But, basically it would be a design decision and evidently it would require a thorough analysis of the pros and cons of all possible approaches in that situation.

    posted on 2012-04-01 16:32 gembin 閱讀(674) 評論(0)  編輯  收藏 所屬分類: XML

    導航

    統計

    常用鏈接

    留言簿(6)

    隨筆分類(440)

    隨筆檔案(378)

    文章檔案(6)

    新聞檔案(1)

    相冊

    收藏夾(9)

    Adobe

    Android

    AS3

    Blog-Links

    Build

    Design Pattern

    Eclipse

    Favorite Links

    Flickr

    Game Dev

    HBase

    Identity Management

    IT resources

    JEE

    Language

    OpenID

    OSGi

    SOA

    Version Control

    最新隨筆

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    free counters
    主站蜘蛛池模板: 亚洲国产aⅴ综合网| 亚洲免费综合色在线视频| 亚洲一区中文字幕在线观看| 亚洲熟女综合一区二区三区| 亚洲欧美国产日韩av野草社区| 成年网在线观看免费观看网址 | 男女超爽视频免费播放| 中文字幕一区二区免费| 波多野结衣免费在线观看| 暖暖免费高清日本中文| 日本红怡院亚洲红怡院最新| 亚洲日本乱码一区二区在线二产线| 亚洲无人区码一二三码区别图片| 日本高清免费中文在线看| 久久精品免费视频观看| 免费人成视频在线观看不卡| 911精品国产亚洲日本美国韩国 | 亚洲视频.com| 深夜福利在线视频免费| 亚洲天堂免费在线| 亚洲AV人人澡人人爽人人夜夜| 最新亚洲人成网站在线观看| 67194成手机免费观看| 亚洲精品国产精品乱码不卡| 亚洲精品无码少妇30P| 91免费精品国自产拍在线不卡| 亚洲精品免费视频| 国产亚洲精品免费视频播放| 亚洲婷婷国产精品电影人久久| 亚洲av日韩专区在线观看| 日韩吃奶摸下AA片免费观看| 亚洲成综合人影院在院播放| 久久大香香蕉国产免费网站 | 亚洲三级电影网址| 最近2022中文字幕免费视频| 久久久久亚洲精品日久生情| 久久国产精品免费专区| 亚洲男人的天堂在线| 久久精品无码一区二区三区免费| 亚洲人成免费网站| 妞干网免费视频在线观看|