Generates the XML content and the XSLT and CSS style sheets for a Web DataWindow, which is transformed to XHTML on the client side.
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
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. |
Integer. 1 indicates success, and –1 indicates failure.
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.
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();