Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Practical XML for the Web - Page 16

November 11, 2002

This excerpt from Chapter 8 of "Practical XML for the Web" sets the scene for server-side XML, and shows what you can do with it, by way of a parallel example done in ASP, PHP, and JSP.

Introduction To Server-Side XML

In this chapter, and the ones to follow, we'll switch from client-side to server-side XML processing. We'll start by examining why you would want to consider server-side processing, and then we'll introduce the three main server-side languages used in web development: ASP, JSP, and PHP.

We'll discuss the pros and cons of each, and then go through some simple XML processing techniques with short code examples from each language. By way of a running example, we'll show you how to maintain an online list of your favorite CDs, stored in XML format. You'll learn how to add new elements to the XML document, modify existing ones, and delete unwanted items. You'll also learn how to transform the XML to HTML.

We'll go through this step-by-step, showing you the code needed in all three languages, giving you a solid overview of basic server-side XML techniques.

The chapters that follow will then show you in-depth case studies for each of these languages.

Server-Side Versus Client-Side XML Processing

By now you're probably all excited about what's possible using client-side XML processing. So why would you want to learn about server-side techniques? Trust me, you do.

Server-side XML gives you even more power. For example, since the processing is done on the server, only the results are sent to the client, so you don't have to worry about making your code cross-browser compatible. It is true that processing XML on the server-side transfers some of the load to the server, but since web servers are usually extremely powerful creatures with the ability to cache data, that is probably nothing to be worried about.


In addition, the server-side approach also greatly reduces the amount of data that flows across the network connection. If you want to display different results for different browsers, then that is easily accomplished by detecting the browser-type on the server side and using the correct stylesheet for the transformation.

The following points sum up the advantages of server-side processing:

  • Systems can provide better performance and maintainability for data-driven web sites by generating and caching frequently accessed pages ahead of time on the server.
  • You can have direct control over the security of your data – sensitive information can be filtered out before sending the data to the client. For example (an extreme one), if we have an XML document that contains a list of users and passwords, there is a security risk involved in sending the whole XML document to the client to be transformed there – it would be better to filter the passwords out of the server side.
  • Maintaining your code becomes easier, since you don't have to modify it when new browser types or versions become available.
  • By doing transformations on the server side you can greatly simplify what is sent to the client, avoiding the problem of designing functionality that works for all possible browser combinations (even mobile devices).

XML support in browsers is still limited, so if you want to dispense with browser-compatibility issues and suchlike, I would recommend that you use client-side XML processing only when developing something like closed intranets where all clients use the same browser. Your safest bet is still usually server-side processing.

Before We Continue

This chapter contains code examples using ASP, PHP, and JSP. If you wish to try running these examples on your computer, then you need to install some software before you continue.

Detailed installation instructions for each language can be found online at http://www.glasshaus.com/.

Removing Content with XSLT - Page 15
Practical XML for the Web
Server-Side Languages - Page 17


Up to => Home / Authoring / Languages / XML / PracticalXML




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers