Chapter 15. Working with XML Data
There's no escape from Extensible Markup
Language (XML) these days. It's everywhere: in
configuration files, messages between servers, web pages, even
databases. Wherever there's structured data, XML is
often found close by.
As I mentioned earlier, JSP pages can generate any type of text,
including XML. In the simplest case, the JSP page includes static XML
elements as template text and a few actions to add the dynamic data,
similar to the HTML examples in previous chapters. A more
sophisticated page gets raw XML data from somewhere and transforms it
to different XML formats depending on the type of browser making the
request.
More and more, web
applications also consume XML data generated by an external source,
perhaps a database or another server. Such an application may extract
price information from different vendors' product
catalogs, published as XML documents, and create a side-by-side
comparison.
In this chapter we first look at the things you need to be aware of
when generating XML responses with JSP, including device-dependent
transformations, and then how to process XML data in different ways.
 |