Serving XHTML Pages as Pure XML Pages

LANSA Web Functions

Serving XHTML Pages as Pure XML Pages

The following information is provided if you are intending to serve your LANSA for the Web XHTML pages as pure XML pages instead of HTML/XHTML pages.

 

Internet media type (MIME type) for XHTML

As of the publication of the XHTML 1.0 W3C recommendation, the general recommended MIME labeling for XML-based applications was not resolved. It makes no recommendation about MIME labeling for XHTML documents that do not need backward compatibility with HTML user agents.

Because you want to preserve compatibility with HTML user agents, continue using MIME type text/html.

Note: There are issues relating to the inclusion of the XML declaration in XHTML documents. In principle, user agents should rely on the MIME type to determine if a document should be handled as an HTML or XML document. However, some versions of current browsers "sniff" an incoming Web page and if they see the XML declaration, they handle the document as an XML document regardless of the HTTP MIME type sent by the Web server. To avoid this problem the shipped DTDs do not include the XML declaration.

 

If you want to serve your Web pages as pure XML documents, then you follow these steps:

Step 1. Add the XML declaration to the DOCTYPE pages

Using the LANSA for the Web Function Editor, add the XML declaration in the DOCTYPE pages DTD_FRAMESET, DTD_STRICT and DTD_TRANSITIONAL. Use an encoding appropriate to your language's character set.

For example:

Step 2. Change the LANSA for the Web server configuration

If you are using CGI-BIN:

1.  Add the following row to table LWEB.DAT located in the LANSA shared library:

Column

Value

XLWPEN

'HTM'

XLWSEN

Blanks

XLWGRP

'MIMETYPE  '

XLWLID

0

XLWMDF

Y

XLWDTA

text/xml

XLWSP1

Blanks

 

 

2.  Uncomment the XML declaration in the PREAMBLE group. Add the encoding appropriate to your language's character set.

Column

Value

XLWPEN

'HTM'

XLWSEN

Blanks

XLWGRP

'PREAMBLE  '

XLWLID

0

XLWMDF

Y

XLWDTA

<?xml version="1.0" encoding="ISO-8859-1"?>

XLWSP1

Blanks

 

  

If you are using Java Servlet:

1.  Add line MIMETYPE=text/xml to configuration file L4W3SERV.CFG.

2.  Set the current directory to the home of the Java Servlet L4W3Servlet.jar.

3.  Extract L4W3Resource.properties from jar file L4W3Servlet.jar (Select the properties file relevant to your locale). Use the Java command:

jar -xf L4W3Servlet.jar com/lansa/web/servlet/L4W3Resource.properties

 

4.  Locate the properties file in the subdirectory tree com/lansa./web/servlet under your current directory.

5.  Change the value of property PR00 in the properties file, to uncomment the XML declaration.

6.  Update the jar file. Use the Java command:

jar uf L4W3Servlet.jar com/lansa/web/servlet/L4W3Resource.properties

 

7.  If your jar file is on an iSeries, you will need to recompile the jar file. Use the OS/400 command (replace path with the actual IFS path to the jar file):

CRTJVAPGM CLSF('/path/L4W3Servlet.jar') OPTIMIZE(40)