Subsections
- XML
- XSLT
- Enterprise Java Beans
- Java Messaging Service
- eXtensible Stylesheet Language: Transformation
- XSLT documents are instructions that describe how to transform one XML document into another type of XML document.
- Example uses:
- Converting the XML for an order into HTML that displays the order to the user.
- Converting an XML invoice from a vendor's system into XML that your internal system understands.
- This sample shows how to transform the sandwich XML from the previous section into HTML.
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<sandwich price="2.00">
<meat>Pastrami</meat>
<bread>Rye</bread>
<cheese slices="1">Swiss</cheese>
</sandwich>
XSLT:
<!-- XSLT is itself XML -->
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/sandwich">
<!-- the HTML tags are embedded directly in the template -->
<html>
<head><title>My Sandwich</title></head>
<body>
<!-- when executed, the value-of element is replaced
with the actual value -->
<b>Meat:</b> <xsl:value-of select="meat" /><br />
<b>Bread:</b> <xsl:value-of select="bread" /><br />
<b>Cheese:</b> <xsl:value-of select="cheese/@slices" />
slice(s) of <xsl:value-of select="cheese" />
<br /><br />
<b>Cost:<xsl:value-of select="@price" /></b>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Output:
<html>
<head>
<title>My Sandwich</title>
</head>
<body>
<b>Meat:</b>Pastrami<br />
<b>Bread:</b>Rye<br />
<b>Cheese:</b>1 slice(s) of Swiss
<br /><br />
<b>Cost: 2.00</b>
</body>
</html>
- The JAXP defines the API for executing XSLT transformations.
- Allows the developer to write components without explicitly coding for database storage, transactions, thread safety, or remote invocation.
- XML configuration files are used to mark how components are mapped to databases, which methods require transactions, and how the components can be accessed.
- The EJB specification is implemented by many vendors including IBM, Borland, BEA, Oracle, and Macromedia. There are also a few open source implementations.
- Provides asynchronous message based communication to Java applications.
- There are two styles of JMS:
- Queues - Messages are stored in queues where they can be processed in the order received.
- Publish and Subscribe - Multiple subscribers are notified when messages are published.
- JMS can guarantee message delivery
- Messages can be processed as part of a transaction. If the transaction is rolled back, the message activity is also rolled back.
|
|