tailieunhanh - Beginning XML with DOM and Ajax From Novice to Professional phần 4

Nhiều người trong số những lời khuyên này có thể hữu ích khi làm việc với các từ vựng web khác. Bao gồm JavaScript trong trang của bạn Đối với hiệu lực, cách tốt nhất để lưu trữ JavaScript của bạn trong một tập tin riêng biệt và giới thiệu nó với các yếu tố Nếu bạn có thể 't tránh nhúng JavaScript trong một tài liệu XHTML, | 116 CHAPTER 4 CLIENT-SIDE XML The aim of the project is to provide online content for students and teachers through learning objects. A high proportion of the learning objects available use Flash and XML for portability and platform independence. You can find examples of learning objects at http tlf2 nodeID 242 groups. Figure 4-10 shows one learning object. Figure 4-10. A Flash movie displaying XML content Now that I ve covered the range of client-side options available for working with XML data let s examine when client-side processing is appropriate. Choosing Between Client and Server It s important to decide whether an XML application should use client-side XML server-side XML or some combination of the two types of processing. So far you ve seen several clients that can work with XML content. In Chapters 5 to 10 you ll look at client-side communication in more detail. Chapters 11 to 13 will examine server-side applications. In this section I ll cover different approaches for client-side and server-side interactions in XML applications. CHAPTER 4 CLIENT-SIDE XML 117 Using Client-Side XML At the beginning of this chapter you saw that the main benefits of working with XML on the client were a reduction of traffic between server and client and a reduction in server-side load. Let s examine these concepts more closely with an example. Suppose you need to display a list of properties that are for sale on a web site. Using XHTML and server-side processing you could Load a list of the property addresses and allow users to drill down to view the details of each property on a separate page List all details of every property in a list on a single page The second approach isn t practical. If you need to display a large number of properties the page will be very long and will take a long time to download. You will also have a hard time locating information. In the first approach viewing the details of a new property requests .