Client-Side Presentation Logic
633
.text + " and has duration of " +
vacDeals.XMLDocument
.documentElement
.childNodes.item(0)
.childNodes.item(1).text + "<P>" );
document.write("The second special has destination of " +
vacDeals.XMLDocument
.documentElement
.childNodes.item(1)
.childNodes.item(2).text);
</script>
This segment reads the element values from the first trip's startdate, and the second trip's destination.
In-depth coverage of Javascript, IE Dynamic HTML DOM, or IE Dynamic HTML programming is
beyond the scope of this section. Interested readers are encouraged to consult Professional
Javascript (ISBN 1-861002-70-X) and XML IE5 Programmer's Reference (ISBN 1-861001-
57-6) from Wrox for more information.
Netscape 6 Support for Cascading Style Sheet XML
Formatting
Internet Explorer browsers have had various levels of support for XML since the 4.x version. Netscape,
on the other hand, provided no native support for formatting of XML-based data until version 6.x. The
rendering engine was replaced by a high-performance open source "Gecko engine" technology and
support for XML data is now native.
The formatting support at version 6.0 of the browser (the most recent available at the time of writing) is
confined to Cascading Style Sheets Level 1, and additionally supporting some Cascading Style Sheets
Level 2 features. Support for CSS1 in the formatting of HTML documents has long been standard in
both the Microsoft and Netscape browsers. However, support for specific CSS2 features such as tables,
and formatting of XML documents, is new for the Netscape 6.0 browser.
Here is a JSP file that utilizes the possibilities offered, called NScss2.jsp:
<?xml version="1.0" ?>
<%@ page language="java" import="com.wrox.pjxml.*" contentType="text/xml" %>
<?xml-stylesheet type="text/css" href="trip.css" ?>
<triplist>
<title>Wrox Travel Center</title>
<topic>CSS2 Formatting via JSP Generated XML Data</topic>
<%!
public DealsFinder myFinder;
public void jspInit() {
myFinder = new DealsFinder();
myFinder.init();
}
%>
<%
String myStr = myFinder.locateDealsXML(0);
int chop = myStr.indexOf(">");
myStr = myStr.substring(chop + 1); %>
<%= myStr %>
</triplist>