Plands.com Logo  Business Internet Services 
Main Menu
Home
Planetary CRM
  Benefits
  Features
  Demo
E-Mail Services
  E-mail Hosting
  Newsletters
  Discussion Lists
Web Hosting
Server Co-location
and Administration
Web Applications
Technical Support
Contact Us
DXP Samples
 
DxpHome  ||   Samples  ||   Details  ||   Docs  ||   Trees  ||   xml-xsl  ||   Links

A dxp page is compiled from an xml source file and stored as a server side Object by a cache in a DxpServlet. A dxp page responds to an http request and writes a result back to a OutputStream which the DxpServlet sends back to the caller.

<?xml version="1.0"?>
<dxp:DxpPage xmlns:dxp="dxp.plands.com" buffsize="4096">
...other dxp tags go here...
</dxp:DxpPage>

The default contentType returned by a DxpPage is "text/html". You can change this by setting the contentType attribute. DxpPages can deliver xml content but you must set the contentType attribute and configure your webserver to deliver the correct mime type for xml and xsl files.


<?xml version="1.0"?>
<dxp:DxpPage xmlns:dxp="dxp.plands.com" contentType="text/xml" buffsize="4096">

<!-- specify stylesheet for client. CDATA tells the SAX parser to ignore this -->
<![CDATA[ <?xml-stylesheet type="text/xsl" href="http://dxp.plands.com/xml-xsl/style/recordset.xsl" ?> ]]>

<dxp:DbStmtX action="query" dbcon="datauser" store="result">
 <dxp:Cp name="sql">Select username, beverage, cost from userpref</dxp:Cp>
</dxp:DbStmtX>
...
</dxp:DxpPage>

A DxpPage can tell the DxpServlet to save it's result as a static file so it can be delivered directly by apache from then on and does not have to run each time. To do this set the attribute staticFile to a value that does NOT have a dxp extension.

<dxp:DxpPage xmlns:dxp="dxp.plands.com" staticFile="dailygrind.html" buffsize="4096">
 <html><head><title>Daily Page</title></head>
 <dxp:AuthUser type="SESSION" database="mycompany" lifespan="120">
   <dxp:Resource priv="POST" name=".updates" />
   <dxp:Redirect>http://mycompany.com/timeout.html</dxp:Redirect>
 </dxp:AuthUser>
  <body bgcolor="#FFFFFF">
   

This page is only changed once per day by an authorized user. It writes a static file that is delivered by apache.

</body> </html> </dxp:DxpPage>

IMPORTANT: if you use a non-standard extension like '.xyz' to deliver html content then you must configure your webserver to return the correct contentType because it will deliver the static file to clients and needs to tell them. For example, suppose you want to use '.dxps' to deliver static html content and 'xmls' to deliver static xml content using apache. Make 'AddType' to the following section of apache's httpd.conf file in this section:

#
# Document types.
#
<IfModule mod_mime.c>
...
  AddType text/html .dxps
  AddType text/xml .xmls
...
# While you're at it, check for .xml and .xsl and add them if they are not there
 AddType text/xml .xml
 AddType text/xml .xsl
...
</IfModule>   

If you call your static files '.html', browsers and proxy servers will cache it and may not pick up your new version when you want them to. You can try setting a couple of meta tags in the <head> section of the html page to tell them not to cache the page.

<html>
<head>
  <meta http-equiv="pragma" content="no-cache"> <!-- for Netscape -->
  <meta http-equiv="expires" content="0"> <!-- for IE --> 
</head>
...

The buffsize attribute in a DxpPage should be set slightly larger than the average size the page will normally deliver. This may vary for database related pages that return different sets of results. You can test the average size by calling the page with your browser and then saving the result as a local file.

The attribute debug can be set to 'true' is you want tags to print msgs to the stdout and stderr. This may appear in different files or the console depending on how you servelt runner.

If a DxpPage contains an AuthUser tag the user or session will be checked by the the DxpServlet before it runs the page.


Return to Index

Note: We have tried to test all of the code examples but they may contain errors. Any questions, comments, suggestions, or problems should be sent to info@plands.com.