GenerateXMLWeb method (DataWindows)
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.
Controls
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
Syntax
[Web DataWindow server component]
1 |
string <span>dwcontrol</span>.<span>GenerateXMLWeb</span> ({<span>page</span>[ ] variables}) |
Argument |
Description |
---|---|
dwcontrol |
The name of the server-side DataWindow |
page |
An array for passing page variables. |
Return Values
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:
1 |
String resourceBase = request.getScheme() + "://" +<br>   request.getServerName() + ":" +<br>   request.getServerPort() + request.getContextPath();<br> <br>String publishPath = application.getRealPath("/");<br> <br>dwGen.Modify("DataWindow.XMLGen.ResourceBase = '" +<br>   resourceBase + "/xml'");<br> <br>dwGen.Modify("DataWindow.XMLGen.PublishPath = '" +<br>   publishPath + "xml'");<br> <br>dwGen.Modify("DataWindow.XSLTGen.ResourceBase = '" +<br>   resourceBase + "/xsl'");<br> <br>dwGen.Modify("DataWindow.XSLTGen.PublishPath = '" +<br>   publishPath + "xsl'");<br> <br>dwGen.Modify("DataWindow.CSSGen.ResourceBase = '" +<br>   resourceBase + "/css'");<br> <br>dwGen.Modify("DataWindow.CSSGen.PublishPath = '" +<br>   publishPath + "css'");<br> <br>dwGen.Modify("DataWindow.JSGen.ResourceBase = '" +<br>   resourceBase + "/js'");<br> <br>dwGen.Modify("DataWindow.JSGen.PublishPath = '" +<br>   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
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:
1 |
dwGen.<span>GenerateXMLWeb</span>(); |