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

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

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

    牛仔褲的夏天

    JAVA是藍色的- online

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      30 隨筆 :: 5 文章 :: 15 評論 :: 0 Trackbacks

    When to use DOM

    If your XML documents contain document data (e.g., Framemaker documents stored in XML format), then DOM is a completely natural fit for your solution. If you are creating some sort of document information management system, then you will probably have to deal with a lot of document data. An example of this is the Datachannel RIO product, which can index and organize information that comes from all kinds of document sources (like Word and Excel files). In this case, DOM is well suited to allow programs access to information stored in these documents.

    However, if you are dealing mostly with structured data (the equivalent of serialized Java objects in XML) DOM is not the best choice. That is when SAX might be a better fit.

    When to use SAX

    If the information stored in your XML documents is machine readable (and generated) data then SAX is the right API for giving your programs access to this information. Machine readable and generated data include things like:

    • Java object properties stored in XML format
    • queries that are formulated using some kind of text based query language (SQL, XQL, OQL)
    • result sets that are generated based on queries (this might include data in relational database tables encoded into XML).

    So machine generated data is information that you normally have to create data structures and classes for in Java. A simple example is the address book which contains information about persons, as shown in Figure 1. This address book XML file is not like a word processor document, rather it is a document that contains pure data, which has been encoded into text using XML.

    When your data is of this kind, you have to create your own data structures and classes (object models) anyway in order to manage, manipulate and persist this data. SAX allows you to quickly create a handler class which can create instances of your object models based on the data stored in your XML documents. An example is a SAX document handler that reads an XML document that contains my address book and creates an AddressBook class that can be used to access this information. The first SAX tutorial shows you how to do this. The address book XML document contains person elements, which contain name and email elements. My AddressBook object model contains the following classes:

    • AddressBook class, which is a container for Person objects
    • Person class, which is a container for name and email String objects.

    So my "SAX address book document handler" is responsible for turning person elements into Person objects, and then storing them all in an AddressBook object. This document handler turns the name and email elements into String objects.

    Conclusion

    The SAX document handler you write does element to object mapping. If your information is structured in a way that makes it easy to create this mapping you should use the SAX API. On the other hand, if your data is much better represented as a tree then you should use DOM.

    posted on 2006-02-22 21:52 luckyrobbie 閱讀(199) 評論(0)  編輯  收藏 所屬分類: XML

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 天天影视色香欲综合免费| 中文字幕的电影免费网站| 免费人成视频在线| 激情五月亚洲色图| 四虎免费大片aⅴ入口| 亚洲国产一区二区三区在线观看| 国产va免费精品观看精品| 亚洲偷自精品三十六区| 一个人免费观看在线视频www| 亚洲一区二区三区国产精品无码| www.黄色免费网站| 国产人成亚洲第一网站在线播放| 成人啪精品视频免费网站| 鲁死你资源站亚洲av| 亚洲国产成人久久一区WWW| 9i9精品国产免费久久| 亚洲国产精品lv| 黄色免费网站网址| 亚洲成在人线aⅴ免费毛片| 亚洲国产成人乱码精品女人久久久不卡| 国产精品亚洲色婷婷99久久精品| 亚洲精品国产综合久久一线| 拍拍拍无挡免费视频网站| 亚洲综合激情视频| 一本无码人妻在中文字幕免费 | 午夜免费啪视频在线观看| 亚洲综合视频在线观看| 成年人免费观看视频网站| 一级毛片在播放免费| 亚洲毛片在线观看| 韩国18福利视频免费观看| 国产99视频精品免费视频76| 久久精品国产亚洲AV香蕉| 国产精品美女午夜爽爽爽免费| 国产亚洲午夜精品| 久久久久无码精品亚洲日韩 | yy6080久久亚洲精品| 免费无码又爽又刺激一高潮| 亚洲av一本岛在线播放| 亚洲国产成人久久综合野外| 最近免费视频中文字幕大全|