Core JSTL[c] Mastering the JSP Standard Tag Library

   

Topics in This Chapter

  • A Simple XML File

  • XML Actions Overview

  • XPath Overview

  • Using Scoped Variables in XPath Expressionss

  • Parsing XML

  • Transforming XML with XSLT

  • Filtering XML

  • Accessing External Entities

XML and the Java programming language ”which represent portable data and portable code, respectively ”are a powerful combination for developing portable Web applications that can freely share information.

XML, which stands for e X tensible M arkup L anguage, is a meta-language that can be used to define markup languages, such as XHTML. XML lets you define a document's structure with extensible markup, meaning tags that you define; for example, see "A Simple XML File" on page 424, which uses XML to define the structure of a simple Rolodex document. XML provides the following benefits:

  • Simplicity : XML defines document structure with textual elements. That way, humans and computers alike can easily read and understand the document.

  • Extensibility : Unlike other markup languages, for example, HTML, XML does not define a fixed set of tags for markup. You can define your own set of markup tags for different types of documents.

  • Separation of content from presentation : Although you can certainly use XML to define a document's presentation, typically, XML is used to define document structure only. That lets you reuse the same XML document for multiple presentations, which are typically generated with XSL Transformation language (XSLT) stylesheets.

  • Openness and widespread industry adoption : XML is not a proprietary language and can be freely used without restrictions. XML has been widely adopted by companies in the computer industry, including Sun and Microsoft.

JSTL provides a comprehensive set of XML actions that greatly facilitate the implementation of XML-based Web applications. Those actions, which are the focus of this chapter, support parsing and transforming XML and also provide additional features such as accessing XML documents with the XPath language, filtering XML, specifying transformation parameters, and accessing external entities. All of those features are discussed in the sections that follow.

   

Категории