Skip Headers

Oracle® XML Developer's Kit Programmer's Guide
10g Release 1 (10.1)

Part Number B10794-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

2 Getting Started with XDK Java Components

This chapter contains these topics:

XDK Java Components Specifications

XDK Java components, release 10.1, are built on these specifications:

DOM Specifications

In release 10.1, the DOM APIs include support for two new working drafts, DOM Level 3 Validation and DOM Level 3 Load and Save.

Load and Save

The DOM Level 3 Load and Save module enables software developers to load and save XML content inside conforming products. DOM 3.0 Core interface DOMConfiguration is referred by DOM 3 Load and Save. Although DOM 3.0 Core is not supported, a limited implementation of this interface is available.

The following configuration parameters are supported by XMLDOMBuilder which implements LSParser:

  • "cdata-sections"

  • "validate"

  • "validate-if-schema"

  • "whitespace-in-element-content"

The following configuration parameters are supported by XMLDOMWriter which implements LSSerializer:

  • "format-pretty-print"

  • "xml-declaration"

Validation

DOM 3.0 validation allows users to retrieve the metadata definitions from XML schemas, query the validity of DOM operations and validate the DOM documents or sub-trees against the XML schema.

Some DOM 3 Core functions referred by Validation are implemented, but Core itself is not supported:

NameList and DOMStringList in DOM core are supported for validation purpose.

Validation is based on XML Schema, DTD needs to be converted to Schema first (use DTDToSchema utility).

XSL Transformations Specifications

The XSLT processor adds support for the current working drafts of XSLT 2.0, XPath 2.0, and the shared XPath/XQuery data model.

For the XPath 2.0 specification, only the new XPath 2.0 grammar and backwards compatibility with XPath 1.0 are supported.

These features of the specifications are not supported in release 10.1:

  • The functions in the Functions and Operators specification are not supported. Only the functions from XSLT 1.0 specification are supported.

  • The validate and complex types in SequenceType expressions are not supported.

  • The new datatypes fn:yearMonthduration and fn:dayTimeDuration are not supported.

  • The Schema Import and Static Typing features are not supported.

  • The XSLT instructions xsl:result-document and xsl:namespace are not supported.

  • The XSLT instructions xsl:text and xsl:number use XSLT 1.0 semantics and syntax.

  • The standard attributes are allowed only on xsl:stylesheet and literal result elements, except for default-xpath-namespace and version.

  • The processor does not honor the following attributes:

    • [required] on xsl:param

    • [XML Schema related attributes, like xsl:validation and xsl:type, etc.

  • Regular expression functions are not supported.

  • Parameters are not passed through built-in templates.

  • xsl:sequence is not supported

Installing XDK Java Components

XDK Java components are included with the Oracle database and with the Oracle application server. You can download the latest beta or production version of XDK Java components from OTN as part of the XDK. The XDK Java components and JavaBeans are now bundled together.

If you installed XDK with the Oracle database or the Oracle application server, you can use this chapter as a reference.

If you download the XDK from OTN, follow these steps:

XDK Java Components Directory Structure

After installing the XDK, the directory structure is:

-$XDK_HOME
    | - bin: executable files and setup script or batch files.
    | - lib: library files.
    | - xdk:
         | - admin: (Administration): SQL script and XSL Servlet Configuration
                     file (XSQLConfig.xml).
         | - demo/java: demonstration code 
         | - doc/java: documents including release notes and Javadoc HTML.

All the XDK Java components are certified and supported with JDK 1.2, JDK 1.3, and JDK 1.4. Make sure that your CLASSPATH includes all the necessary libraries:

Table 2-1 XDK Java Components Libraries

Component Library Notes
XML Parser, XSL Processor xmlparserv2.jar XML Parser V2 for Java, which includes JAXP 1.1, DOM, SAX and XSLT APIs.
Message files for XML Parser. xmlmesg.jar If you want to use XML Parser with a language other than English, you need to set this JAR file in your CLASSPATH.
XML Schema Processor xschema.jar XML Schema Processor for Java.
XML SQL Utility xsu12.jar XML SQL Utility for JDK 1.2 and later.
XSQL Servlet oraclesql.jar Oracle XSQL Servlet.
XSQL xsqlserializers.jar Oracle XSQL Serializers for FOP/PDF Integration.
JAXB Class Generator, Pipeline Processor, Differ xml.jar Class Generator for Java.
JavaBeans xmlcomp.jar

xmlcomp2.jar

JavaBeans Utilities.
TransX Utility transx.zip Oracle TransX Utility.

In addition, XML SQL Utility, XSQL Servlet, and TransX Utility all depend on JDBC and globalization support libraries, which are listed in Table 2-2:

Table 2-2 JDBC and Globalization Support Libraries for XDK Java Components

Component Library Notes
JDBC classes12.zip JDBC for JDK 1.2 and later.
Globalization Support orai18n.jar Globalization support for JDK 1.2 and later.
XMLType xdb.jar XMLType Java APIs in $ORACLE_HOME/rdbms/jlib/
JDeveloper Runtime jdev-rt.zip Java GUI libraries.

XDK Java Components Environment Settings

The UNIX and Windows environment settings are listed:

UNIX Environment Settings for XDK Java Components

This file sets up the environment:

$XDK_HOME/bin/env.csh

Table 2-3 lists the UNIX environment variables, with the ones that must be customized each marked with "Yes":

Table 2-3 UNIX Environment Settings for XDK Java Components

Variable Notes Yes/No
$JDBCVER JDBC version. For JDK 1.2 and later, set to 12. Yes
$JDKVER JDK version obtained by JDK -version.Default value is 1.2.2_07. Yes
$INSTALL_ROOT Installation root of XDK which is the directory $XDK_HOME. No
$JAVA_HOME Directory where the Java JDK, Standard Edition is installed. Yes
$CLASSPATHJ {ORACLE_HOME}/jdbc/lib/classes${JDBCVER}.zip:

${ORACLE_HOME}/jdbc/lib/nls_charset${JDBCVER}.jar

If you are running the XSU on a system different from where the Oracle database is installed, you have to update your CLASSPATHJ setting with the correct locations of the JDBC library (classes12.jar). The orai18n.jar is needed to support certain character sets. See "XDK Java Components Globalization Support". Note that if you do not have these libraries on your system, these are both available on OTN (http://otn.oracle.com), as part of the JDBC driver download.

Yes
$CLASSPATH Include the following:

.:${CLASSPATHJ}:${INSTALL_ROOT}/lib/xmlparserv2.jar:

${INSTALL_ROOT}/lib/xschema.jar:

${INSTALL_ROOT}/lib/xsu${JDBCVER}.jar:

${INSTALL_ROOT}/lib/oraclexsql.jar:

${INSTALL_ROOT}/lib/classgen.jar

No
$PATH ${JAVA_HOME}/bin:${PATH}:${INSTALL_ROOT}/bin No
$LD_LIBRARY_PATH For OCI JDBC connections:

${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}

No

Windows Environment Settings for XDK Java Components

This file sets up the environment:

%XDK_HOME%\bin\env.bat

Table 2-4 lists the Windows environment variables with the ones that must be customized each marked with "Yes":

Table 2-4 Windows Environment Settings for XDK Java Components

Variable Notes Yes/No
%JDBCVER% JDBC version. If using JDK 1.2 and later, it should be set to 12. Yes
%JDKVER% JDK version which you can get from: JDK -version.Default value is 1.2.2_07. Yes
%INSTALL_ROOT% Installation root of XDK, which is the directory %XDK_HOME%. No
%JAVA_HOME% Directory where the Java SDK, Standard Edition is installed. Yes
%CLASSPATHJ% CLASSPATHJ=%ORACLE_HOME%\jdbc\lib\classes%JDBCVER%.zip;

%ORACLE_HOME%\jdbc\lib\nls_charset%JDBCVER%.jar

Yes
%CLASSPATH% .;%CLASSPATHJ%;%INSTALL_ROOT%\lib\xmlparserv2.jar;

%INSTALL_ROOT%\lib\xschema.jar;

%INSTALL_ROOT%\lib\xsu%JDBCVER%.jar;

%INSTALL_ROOT%\lib\oraclexsql.jar;%INSTALL_ROOT%\lib\classgen.jar

No
%PATH% PATH=%JAVA_HOME%\bin;%ORACLE_HOME%\bin;%PATH%;%INSTALL_ROOT%\bin No

Setting Up XSQL Servlet

The XSQL Servlet is designed to run on any Java VM, using any JDBC driver, against any JDBC-enabled database. Oracle Corporation tests it against only the most popular configurations.

XSQL Pages and XSQL Servlet have been successfully tested only with:

Servlet Engines

This XSQL Servlet has been tested with the following servlet engines:

  • Oracle HTTP Server/JServ Servlet Engine

  • Oracle9iAS Oracle Containers for J2EE (OC4J) Servlet Engine

  • Allaire JRun 2.3.3 and 3.0.0

  • Apache 1.3.9 with JServ 1.0 and 1.1

  • Apache 1.3.9 with Tomcat 3.1 or 3.2 Servlet Engine

  • Apache Tomcat 3.1 or 3.2 Web Server + Servlet Engine

  • Caucho Resin 1.1

  • Java Web Server 2.0

  • WebLogic 5.1 Web Server

  • NewAtlanta ServletExec 2.2 and 3.0 for IIS/PWS 4.0

  • Oracle8i Lite Web-to-Go Server

  • Oracle8i 8.1.7 Oracle Servlet Engine

  • Sun JavaServer Web Development Kit (JSWDK) 1.0.1 Web Server

Java Server Pages Implementations

Java Server Pages (JSP) can use <jsp:forward> and/or <jsp:include> to collaborate with XSQL Pages as part of an application. The following JSP platforms have been tested:

  • Oracle9iAS Oracle HTTP Server/JServ Servlet Engine

  • Oracle9iAS OC4J Servlet Engine

  • Apache 1.3.9 with Tomcat 3.1 or 3.2 Servlet Engine

  • Apache Tomcat 3.1 or 3.2 Web Server + Tomcat 3.1 or 3.2 Servlet Engine

  • Caucho Resin 1.1 (Built-in JSP 1.0 Support)

  • NewAtlanta ServletExec 2.2 and 3.0 for IIS/PWS 4.0 (Built-in JSP 1.0 Support)

  • Oracle8i Lite Web-to-Go Server with Oracle JSP 1.0

  • Oracle8i 8.1.7 Oracle Servlet Engine

  • Any Servlet Engine with Servlet API 2.1+ and Oracle JSP 1.0

In general, it should work with any servlet engine supporting the Servlet 2.1 Specification or higher, and the Oracle JSP 1.0 reference implementation or functional equivalent from another vendor.

JDBC Drivers and Databases

The Oracle XSQL Page processor has been designed to exploit the maximum set of features against the Oracle JDBC drivers, but works well against any database with a reasonable JDBC driver. While numerous users have reported successfully using XSQL Pages with many other JDBC drivers, the ones that Oracle has tested are:

  • Oracle8i 8.1.5 Driver for JDBC 1.x

  • Oracle8i 8.1.6 Driver for JDBC 1.x

  • Oracle8i 8.1.7 Driver for JDBC 1.x

  • Oracle8i Lite 4.0 Driver for JDBC 1.x

  • Oracle8i 8.1.6 Driver for JDBC 2.0

  • Oracle8i 8.1.7 Driver for JDBC 2.0

  • Oracle9i 9.0.1 Driver for JDBC 2.0

  • Oracle9i 9.2.0 Driver for JDBC 2.0

Setting Up the Database Connection Definitions for Your Environment

The demos are set up to use the SCOTT schema on a database on your local computer (the computer where the Web server is running). If you are running a local database and have an account SCOTT whose password is TIGER, then you are all set. Otherwise, you need to edit the .\xdk\admin\XSQLConfig.xml file to correspond to your appropriate values for username, password, dburl, and driver values for the connection named demo:

<?xml version="1.0" ?>
<XSQLConfig>
     ...
  <connectiondefs>
    <connection name="demo">
      <username>scott</username>
      <password>tiger</password>
      <dburl>jdbc:oracle:thin:@localhost:1521:ORCL</dburl>
      <driver>oracle.jdbc.driver.OracleDriver</driver>
    </connection>
    <connection name="lite">
      <username>system</username>
      <password>manager</password>
      <dburl>jdbc:Polite:POlite</dburl>
      <driver>oracle.lite.poljdbc.POLJDBCDriver</driver>
    </connection>
  </connectiondefs>
      ...
</XSQLConfig>

Setting Up Your Servlet Engine to Run XSQL Pages

UNIX users and any user wanting to install the XSQL Servlet on other Web servers should continue with the instructions below corresponding to the Web server. In every case, there are these basic steps:

  1. Include the list of XSQL Java archives:

    • xsu12.jar - Oracle XML SQL Utility

    • xmlparserv2.jar - Oracle XML Parser for Java V2

    • oraclexsql.jar- Oracle XSQL Pages

    • xsqlserializers.jar - Oracle XSQL Serializers for FOP/PDF Integration

    • classes12.jar - Oracle JDBC Driver or the JAR file for the JDBC driver you will be using instead

    • Include as well as the directory where XSQLConfig.xml resides (by default ./xdk/admin) in the server CLASSPATH.

  2. Map the .xsql file extension to the oracle.xml.xsql.XSQLServlet servlet class.

  3. Map a virtual directory /xsql to the directory where you extracted the XSQL files (to access the online help and demos).

The following sections describe the instructions specific to these Web servers:

Oracle Application Server (OracleAS)

OracleAS comes preconfigured to run XSQL Servlet. By default its Apache JServ servlet engine contains all of the wrapper.classpath entries in jserv.conf to include the necessary Java archives to run XSQL. The XSQLConfig.xml file is found in the ./xdk/admin subdirectory of the iAS installation home.

OracleAS Oracle Containers for Java (OC4J) Servlet Container

The easiest way to install XSQL Servlet in the OracleAS OC4J servlet container is to install it as an application. Assuming your OC4J installation home is C:\j2ee\home, and that you have extracted the XDK distribution into the C:\xdk directory, here are the setup steps:

  1. Verify that the following JAR files are already in your C:\j2ee\home\lib directory (they should come pre-installed):

    • xmlparserv2.jar - Oracle XML Parser for Java V2

    • classes12.jar - Oracle JDBC Driver

  2. Copy the following additional JAR files from C:\xdk\lib to C:\j2ee\home\lib.

    • xsu12.jar - Oracle XML SQL Utility

    • oraclexsql.jar - Oracle XSQL Pages

    • xsqlserializers.jar - Oracle XSQL Serializers for FOP/PDF Integration

  3. Copy the C:\xdk\admin\XSQLConfig.xml configuration file to the C:\j2ee\home\default-web-app\WEB-INF\classes directory.

  4. Edit the C:\j2ee\home\config\global-web-application.xml server configuration file to add a <servlet> and <servlet-mapping> entry as child elements of the <web-app> element as follows:

    <orion-web-app ...and so on... >
      ...
     etc
      ...
      <web-app>
        <servlet>
          <servlet-name>xsql</servlet-name>
          <servlet-class>oracle.xml.xsql.XSQLServlet</servlet-class>
        </servlet>
        <servlet-mapping>
          <servlet-name>xsql</servlet-name>
          <url-pattern>/*.xsql</url-pattern>
        </servlet-mapping>
         ...
        etc
         ...
      </web-app>
    </web-app>
    
    

At this point, you can refer to any XSQL page in any virtual path and it is processed by the XSQL Servlet. If you want to try the XSQL built-in samples, demos, and online help, then you need to perform the following additional step to map a virtual path of /xsql/ to the C:\xdk\demo\java\xsql directory.

  1. Edit the file:

    c:\j2ee\home\application-deployments\default\defaultWebApp\orion-web.xml
    
    
  2. to add the following <virtual-directory> entry:

    <orion-web-app ...and so on...>
        ...
       etc
        ...
       <virtual-directory
       virtual-path="/xsql"
       real-path="/c:/xdk/xdk/demo/java.101/xsql/" />
        ...
       etc
        ...
    </orion-web-app>
    
    
  3. Then, you can browse the demos using the URL:

    http://yoursever:yourport/xsql/index.html
    

Apache/JServ 1.0 or 1.1

  1. Set up the server CLASSPATH correctly for the XSQL Servlet. This is done by editing the JServ configuration file named jserv.properties.

  2. Assuming that you installed the XSQL Servlet files into C:\, you need to add the following entries to use the Oracle JDBC 1.x driver:

    # Oracle XML SQL Utility (XSU)
    wrapper.classpath=C:\xdk902\lib\xsu111.jar
    # Oracle XSQL Servlet
    wrapper.classpath=C:\xdk902\lib\oraclexsql.jar
    # Oracle JDBC (8.1.6) -- JDBC 1.x driver
    wrapper.classpath=directory_where_JDBC_Driver_resides\classes111.zip
    # Oracle XML Parser V2 (with XSLT Engine)
    wrapper.classpath=C:\xdk902\lib\xmlparserv2.jar
    # XSQLConfig.xml File location
    wrapper.classpath=directory_where_XSQLConfig.xml_resides
    # FOR Apache FOP Generation, Add
    # wrapper.classpath=C:\xdk902\lib\xsqlserializers.jar
    # wrapper.classpath=FOPHOME/fop.jar
    # wrapper.classpath=FOPHOME/lib/batik.jar
    
    
  3. To use the Oracle JDBC 2.0 Driver, the entries are:

    # Oracle XML SQL Utility (XSU)
    wrapper.classpath=C:\xdk902\lib\xsu12.jar
    # Oracle XSQL Servlet
    wrapper.classpath=C:\xdk902\lib\oraclexsql.jar
    # Oracle JDBC (8.1.6) -- JDBC 2.0 driver
    wrapper.classpath=directory_where_JDBC_Driver_resides\classes12.zip
    # Oracle XML Parser V2 (with XSLT Engine)
    wrapper.classpath=C:\xdk902\lib\xmlparserv2.jar
    # XSQLConfig.xml File location
    wrapper.classpath=directory_where_XSQLConfig.xml_resides
    # FOR Apache FOP Generation, Add
    # wrapper.classpath=C:\xdk902\lib\xsqlserializers.jar
    # wrapper.classpath=FOPHOME/fop.jar
    # wrapper.classpath=FOPHOME/lib/w3c.jar
    
    
  4. Map the .xsql file extension to the XSQL Servlet: To do this, you need to edit the JServ configuration file named jserv.conf (in JServ 1.0 this was named mod_jserv.conf on some platforms). Add the following lines:

    # Executes a servlet passing filename with proper extension in PATH_TRANSLATED 
    # property of servlet request.
    # Syntax: ApJServAction [extension] [servlet-uri]
    # Defaults: NONE
    
    ApJServAction .xsql /servlets/oracle.xml.xsql.XSQLServlet
    
    
  5. Map an /xsql/ virtual directory: In this step, we want to map the virtual path \xsql\ to C:\xdk902\xdk\demo\java\xsql\ (or wherever you installed the XSQL Servlet files). To do this, you need to edit the Apache configuration file named httpd.conf and add the following line:

    Alias /xsql/ "C:\xdk902\xdk\demo\java\xsql\"
    
    
  6. Restart the Apache server and browse the URL:

    http://localhost/xsql/index.html
    

Jakarta Tomcat 3.1 or 3.2

Do the following steps:

  1. Set up the Server CLASSPATH for the XSQL Servlet:

    This is done by editing the Tomcat startup script named tomcat.bat in ./jakarta-tomcat/bin and adding the appropriate entries onto the system CLASSPATH before the Tomcat server is started.

    For Oracle JDBC 1.x Driver:

    rem Set up the CLASSPATH that we need
    
    set cp=%CLASSPATH%
    
    set CLASSPATH=.
    set CLASSPATH=%TOMCAT_HOME%\classes
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
    set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
    
    REM Added for Oracle XSQL Servlet
    REM -----------------------------
    set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\xsu111.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\oraclexsql.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\xmlparserv2.jar
    set CLASSPATH=%CLASSPATH%;directory_where_JDBC_Driver_resides\classes111.zip
    set CLASSPATH=%CLASSPATH%;directory_where_XSQLConfig.xml_resides
    REM FOR Apache FOP Generation, Add
    REM set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\xsqlserializers.jar
    REM set CLASSPATH=%CLASSPATH%;FOPHOME/fop.jar
    REM set CLASSPATH=%CLASSPATH%;FOPHOME/lib/batik.jar
    
    

    For Oracle JDBC 2.0 Driver:

    rem Set up the CLASSPATH that we need
    
    set cp=%CLASSPATH%
    
    set CLASSPATH=.
    set CLASSPATH=%TOMCAT_HOME%\classes
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
    set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
    set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
    
    REM Added for Oracle XSQL Servlet
    REM -----------------------------
    set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\xsu12.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\oraclexsql.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\xmlparserv2.jar
    set CLASSPATH=%CLASSPATH%;directory_where_JDBC_Driver_resides\classes12.zip
    set CLASSPATH=%CLASSPATH%;directory_where_XSQLConfig.xml_resides
    REM FOR Apache FOP Generation, Add
    REM set CLASSPATH=%CLASSPATH%;C:\xdk902\lib\xsqlserializers.jar
    REM set CLASSPATH=%CLASSPATH%;FOPHOME/fop.jar
    REM set CLASSPATH=%CLASSPATH%;FOPHOME/lib/batik.jar
    
    
  2. Map the .xsql File Extension to the XSQL Servlet:

    Tomcat supports creating any number of configuration contexts to better organize the Web applications that your site needs to support. Each context is mapped to a virtual directory path, and has its own separate servlet configuration information. XSQL Servlet comes with a preconfigured context file to make XSQL Servlet setup easier.

    By default, Tomcat 3.1 and 3.2 come preconfigured with the following contexts (defined by <Context> entries in the file./jakarta-tomcat/conf/server.xml).

    The root context

    /examples

    /test

    /admin

    Install XSQL Servlet into one of these, but for simplicity create a new context just for the XSQL Servlet that maps to the directory where you installed the XSQL Servlet distribution.

    Edit the ./jakarta-tomcat/conf/server.xml file to add the following <Context> entry with path= "/xsql".

    <Context path="/test" docBase="webapps/test" debug="0" reloadable="true" /> 
    
    <!--
     |  Define a Servlet context for the XSQL Servlet  
     |  
     |  The XSQL Servlet ships with a .\WEB-INF directory
     |  with its web.xml file preconfigured for C:\xdk902\xdk\demo\java\xsql
     |  installation.
     +-->
    <Context path="/xsql" docBase="C:\xdk902\xdk\demo\java\xsql"/>
    
    

    Note that the docBase= "C:\xsql" points to the physical directory where you installed the XSQL Servlet distribution. You then need to create a WEB-INF subdirectory in the C:\xdk902\xdk\demo\java\xsql directory and save the following ./WEB-INF/web.xml file in it:

    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.
    //DTD Web Application 2.2//EN"
     "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
       <servlet>
          <servlet-name>oracle-xsql-servlet</servlet-name>
          <servlet-class>oracle.xml.xsql.XSQLServlet</servlet-class>
       </servlet>
        <servlet-mapping>
          <servlet-name>oracle-xsql-servlet</servlet-name>
          <url-pattern> *.xsql </url-pattern>
       </servlet-mapping>
    </web-app>
    
    

    Note:

    To add the XSQL Servlet to an existing context, add the servlet and servlet-mapping entries that you find in the web.xml file preceding, into the web.xml file for the context in question.

  3. Map an /xsql Virtual Directory:

    This is already achieved by creating the /xsql context in the preceding section.

    Restart the Tomcat server and browse the URL:

    http://localhost:8080/xsql/index.html
    
    

    If you use Tomcat with an XML Parser (such as the Sun Crimson Parser) that only supports DOM Level 1 interfaces, then you must edit tomcat.bat to insure that the Oracle XML Parser's archive xmlparser.jar comes before the DOM Level 1 parser's archive in the CLASSPATH. For example, you could edit tomcat.bat to add the following lines:

    REM NEED TO PUT xmlparserv2.jar FIRST before parser.jar
    set CP=C:\xdk902\lib\xmlparserv2.jar;%CP%
    
    

    just before the lines:

    echo Using CLASSPATH: %CP%
    echo.
    set CLASSPATH=%CP%
    

XDK Java Components Globalization Support

Here is a summary on the settings that relate to Globalization Support:

XDK Java Components Dependencies

Figure 2-1 shows the dependencies of XDK Java Components when using JDK 1.2 and higher:

Figure 2-1 XDK Java Components Dependencies Using JDK 1.2.x and Higher

Description of adxdk110.gif follows
Description of the illustration adxdk110.gif

After you correctly setup the environment, include all the necessary JAR files in your CLASSPATH. You can then start writing your Java programs and compiling them with the javac command:

javac your_program.java

If the compilation finishes without errors, then you can just test your program using the command line or the Web Server.


See Also:

Chapter 3, " XML Parser for Java" for further discussion of the XDK Java components

Verifying the XDK Java Components Version

To obtain the version of XDK you are working with, compile and run the following Java code (XDKVersion.java):

import java.net.URL;
import oracle.xml.parser.v2.XMLParser;
public class XDKVersion
{
   static public void main(String[] argv)
   {
      System.out.println("You are using version: ");
      System.out.println(XMLParser.getReleaseVersion());
   }

}