- Web applications have a three-tier architecture
- Understand where XML fits in this three-tier architecture
- Role of XML in each of these tiers
- Role of XML as data format for communicating between the tiers
- XML as format to deliver data from to the client
- XML goes far beyond HTML
- XML separates content from presentation
- Clients can act intelligently on the XML data
- Clients can also process the data locally
- HTML, on the other hand, limited to presentation
- XML does not specify how data should be presented
- Several mechanisms for instructing browser how to display XML data
- eXtensible Stylesheet Language (XSL)
- Client-side scripting
- A single XML document can have multiple associated stylesheets or client-side scripts
- Each provides the user with a different "view"
- Intelligent client-side searching and sorting
- Different types of users, e.g. bug tracking application
- Bug tracking data in XML
- Different views for project manager and developers
- Users with different types of devices (desktop, PDA)
- Tabular data as pie chart on desktop
- Same tabular data as rows and columns on PDA
- Middle tier hosts different application servers
- Host business logic of an application and aggregate information from multiple data sources
- Factor out common functionality to be reused across multiple application servers
- Web server
- Data integration server
- Facilitates interaction of clients and application servers
- Receives HTTP requests from clients and forwards them tothe appropriate application server
- Then sends back HTTP response to client with data generated by the application server
- It would be inefficient to make each application server implement this functionality independently
- Provides uniform format for all data
- Converts all data to an XML format and passes this to application servers
- Insulates application servers from proprietary and possibly changing formats of underlying data sources
- Complexity reduction
- With integration server number of data conversions is only linear in number of clients and databases
- XML as means to transfer data between applications
- Self-describing messages
- Embedded metadata enables applications to readily examine and manipulate data in a document
- XML data structures are also robust against changes
- Can add new elements or attributes without disrupting existing data structures
- Each application extracts appropriate elements or attributes from messages as appropriate
- Using XML as data source by itself
- Efficient means of storing data
- XML in data tier lends itself for powerful querying
- Simplifies integration of legacy data
- Performance tuning for data-driven applications
- Convenient storage format for richly structured data
- Data not represented in XML requires translation to and from XML in middle tier
- Many databases already support XML
- XPath allows applications to retrieve data from a document in much the same way as querying a database
- Formulate retrieval pattern in XPath (see our discussion of stylesheets)
- Merely that subset of the document which matches the query is returned and sent to the middle tier
- Similar to the integration server on the middle tier
- Adapters around legacy applications can convert data to XML before returning it to the middle tier
- Greatly simplifies integration on middle tier
- However, traditional non-XML technologies (e.g. RDBMS) very mature and represent large investments
- Speed up queries on middle tier by keeping cached copies of data in integration server
- Avoids mapping to and from XML at each access
- But must ensure integrity and consistency