IBM Version 5 manual Validating the Web tier, Example 10-12 Schema file for the XML data

Models: Version 5

1 340
Download 340 pages 15.44 Kb
Page 253
Image 253

<xsl:apply-templates select="firstName"/> <xsl:apply-templates select="lastName"/> <xsl:apply-templates select="email"/>

</table>

</xsl:template>

HTML Files: Under the /Web Content/WEB-INFfolder, you will find the file Customer.html. This file only has a link to the CustomerXSLServlet. Clicking that link will invoke the servlet.

Schema Files: Under the same folder as the HTML file, you will find the schema file Customer.xsd. This is the schema for the XML data representing the customer registration information. Example 10-12 shows the contents of the schema file. It indicates that the root element customer is a complex type. It contains four elements; it shows their names and data types.

Example 10-12 Schema file for the XML data

<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ibm.com" xmlns:Cu="http://www.ibm.com">

<complexType name="Customer"> <sequence>

<element name="membership" type="Cu:Long"/> <element name="firstName" type="string"/> <element name="lastName" type="string"/> <element name="email" type="string"/>

</sequence>

</complexType> <complexType name="Long">

<sequence>

</sequence>

</complexType>

</schema>

Validating the Web tier

Before we continue to the following step, we recommend that you validate the Web tier first. The validation process is very simple. Please do is the following:

1.Righ- click on the Customer.html file, and select Run on Server option. Choose to run the HTML file on the Websphere test environment server. This will automatically close the XML perspective, and open the server perspective. The Web browser will open running the HTML file. It might take some time to start the Websphere test environment.

2.Clink on Click here to invoke the CustomerXSLServlet. The registration form will load on the browser.

Chapter 10. Development of XML-based Enterprise applications 237

Page 253
Image 253
IBM Version 5 manual Validating the Web tier, Example 10-12 Schema file for the XML data