GenerateXMLWeb

Description

Generates XML content, XSLT layout, and CSS style sheets for a Web DataWindow, which is transformed to XHTML on the client side. This method is for use with JSP targets only.

Applies to

PSDataWindowClass and PSWebDataWindowClass objects

Syntax

DWObject.GenerateXMLWeb({page[ ] variables})

Argument

Description

DWObject

A variable that contains a reference to an instance of PSDataWindowClass or PSWebDataWindowClass.

page

An array for passing page variables for objects of type PSDataWindowClass. The page variables must be defined as String datatypes.

Returns

Integer. 1 indicates success, and -1 indicates failure.

Usage

The GenerateXMLWeb function uses the resource base and publish paths for a DataWindow object to determine where it generates XML, XSLT, CSS, and JS files. If a resource base or a publish path is not specified for a DataWindow object, the GenerateXMLWeb function creates a TEMP directory on the server where the XML, XSLT, CSS, and JS files are stored.

At design time, you can override the resource base and publish paths by making Modify calls on the DataWindow object in the Source view before you call GenerateXMLWeb. The following example creates separate subdirectories for XML, XSLT, CSS, and JS files:

String resourceBase = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();String publishPath = application.getRealPath("/");dwGen.Modify("DataWindow.XMLGen.ResourceBase = '" + resourceBase + "/xml'");dwGen.Modify("DataWindow.XMLGen.PublishPath = '" + publishPath + "xml'");dwGen.Modify("DataWindow.XSLTGen.ResourceBase = '" + resourceBase + "/xsl'");dwGen.Modify("DataWindow.XSLTGen.PublishPath = '" + publishPath + "xsl'");dwGen.Modify("DataWindow.CSSGen.ResourceBase = '" + resourceBase + "/css'");dwGen.Modify("DataWindow.CSSGen.PublishPath = '" + publishPath + "css'");dwGen.Modify("DataWindow.JSGen.ResourceBase = '" + resourceBase + "/js'");dwGen.Modify("DataWindow.JSGen.PublishPath = '" + publishPath + "js'");

At runtime, the client browser displays an XHTML page that it transforms from XML, XSLT, CSS, and JS files that it gets initially from the server. However, after the initial loading of the page, the client does not need to go back to the server to obtain structure (XSLT) and layout (CSS) information, as these remain in the browser’s cache. This provides greater efficiency and scalability for your Web applications.

Examples

Example 1

In the following example, the DataWindow object dwGen generates XML, XSLT, and CSS files for the content, structure, and style of the Web DataWindow:

dwGen.GenerateXMLWeb();

See also