GenerateXMLWeb

Description

Generates the XML content and the XSLT and CSS style sheets for a Web DataWindow, which is transformed to XHTML on the client side.

Applies to

DataWindow type

Method applies to

Web

Server component

Syntax

Web DataWindow server component

string dwcontrol.GenerateXMLWeb ({page[ ] variables})

Argument

Description

dwcontrol

The name of the server-side DataWindow control

page

An array for passing page variables. 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 using XSLT applied with CSS and JS files that it gets initially from the server. However, in most cases, after the initial loading of the page, the client does not need to go back to the server to obtain layout (XSLT) or styling (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 Web DataWindow component generates the XML document, XSLT and CSS style sheets, and JS files for the content, structure, styling, and client-side functionality of the Web DataWindow:

dwGen.GenerateXMLWeb();

See also