Writing Mobile Code Essential Software Engineering for Building Mobile Applications [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Writing Mobile Code Essential Software Engineering for Building Mobile Applications [Electronic resources] - نسخه متنی

Ivo Salmre

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید











Different Ways to Work with XML


Due to its utility and popular adoption XML has quickly matured. With this maturation, programming models have arisen that make XML easier to work with. As a general rule, whenever more specialized XML APIs exist, you should avoid working with XML using generic file I/O APIs. Higher-level APIs have the benefit of greatly increasing developer productivity as well as pushing the design and testing burden onto someone else who's sole job it has been to build a great XML parser. If you write your own XML parser, you will be spending a lot of time solving a problem that has already been well addressed by others on lots of different platforms; it is better to concentrate your efforts in areas where you can add unique value.

Despite the fact that existing well-tested and performance-tuned APIs exist, there are still important design decisions to make when using XML. The most important programming decision you will make is what level of API abstraction to use. Will you choose to work with low-level, forward-only XML APIs, or will you work with higher-level random-access XML APIs that expose the XML as an in-memory tree. There are three fundamental approaches for working with XML data:

Roll your own"optimized"parser from scratch .
It is almost never worth doing this if predeveloped and tested approaches exist. This approach is strongly discouraged because the payoff almost never matches the effort required and the long-term maintenance burden incurred.

Use a high-level, general-purpose and random-access XML parsing DOM.
DOM stands for Document Object Model, and it is a way of working with XML data as an in-memory tree. High-level APIs for working with XML result in highly reliable and maintainable code. For smaller XML documents, documents that require constant random access to all parts of the XML document tree, or XML documents that need to be fully re-persisted to files, this approach is a great one.

Use a low-level forward-only reading/writing XML API.
Low-level APIs offer maximum performance but put additional burden on the programmer. These APIs are forward only and allow the XML tree to be read in or written out as a stream of XML elements without storing the whole XML document in memory. On mobile devices where memory is precious and particularly when working with larger sized or read-only data this is the only reasonable approach to achieve acceptable performance. It represents a very good middle ground between using high-level APIs and the roll-your-own approach. This is the right way to go if the high-level APIs require too much processing or memory overhead to meet your needs.


/ 159