Cpanel web hosting - CHAPTER 4 CLIENT-SIDE XML 117 Using Client-Side
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 information from the server, which reloads the interface to display those details. Even if you need only a small amount of information, you ll still need to refresh the page and load additional content from the server each time. Separating the content from the interface saves server traffic and download times each time you want to view another property. One solution is to use XML on the client side. The server downloads the interface once, when you first load the page. Each time you request further property details, you can download the new content to the client, transform and style the XML into the desired format, and insert the styled content into the cached interface. The only problem with this approach is that the application can only run in a client that has the appropriate level of XML support. If the content is served within a web browser, you need to be careful, because the level of support differs greatly between the major players. For example, Opera versions 8 and below don t support XSLT. Using Server-Side XML One solution might be to process the XML on the server instead. Using server-side processing can avoid any of the specific browser issues. However, as discussed, this means users place more load on the server with more frequent trips to request information. Unless you re dealing with a particularly data-intensive application, this isn t likely to overshadow the advantages of the server-side approach. I ll discuss this in more detail in Chapters 11 to 13, where you ll see some approaches to using server-side XML. There are three broad approaches to using XML in web browser applications: Using XML on the server side only and sending XHTML to the web browser Transforming the XML into XHTML for delivery to the browser Serving XML to the web browser and manipulating it with client-side scripting I ll look at each of these approaches in the following sections. I ll examine Flash as a special case in Chapter 10.
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.