Oracle9i XML Developer's Kits Guide - XDK Release 2 (9.2) Part Number A96621-01 |
|
This chapter contains the following sections:
XDK for C contains the basic building blocks for reading, manipulating, transforming XML documents.
Oracle XDK for C consists of the following components:
.xsd
).If you have installed the Oracle database or iAS (Application Server), you will already have the XDK for C installed.
You can also download the latest versions of XDK for C from OTN.
In order to download the XDK from OTN, follow these steps:
http://otn.oracle.com/tech/xml/xdk_c/content.html
Refer to "Getting Started with XDK for Java and JavaBeans" for the details of downloading an XDK (use the XDK for C).
After installing the XDK, the directory structure is:
-$XDK_HOME | - bin: executable files | - lib: library files. |- nlsdata: Globalization Support data files(*.nlb) | - xdk | - demo: demonstration code | - doc: documents including release notes. | - include: header files. | - mesg: message files. (*.msb)
Here are all the libraries that come with the UNIX version of XDK for C:
Component | Library | Notes |
---|---|---|
XSL Processor |
libxml9.a |
XML Parser V2 for C, which includes DOM, SAX, and XSLT APIs |
XML Schema Processor |
libxsd9.a |
XML Schema Processor for C |
The XDK for C (UNIX) depends on the Oracle CORE and Globalization Support libraries in the following table:
Check if the environment variable ORA_NLS33 is set to point to the location of the Globalization Support data files.
If you install the Oracle database, you can set it to be:
setenv ORA_NLS33 ${ORACLE_HOME}/ocommon/nls/admin/data
If no Oracle database is installed, you can set use the Globalization Support data files that come with the XDK release by setting:
setenv ORA_NLS33 ${XDK_HOME}/nlsdata
Check if the environment variable ORA_XML_MESG is set to point to the absolute path of the mesg
directory:
If you install the Oracle database, you can set it to be:
setenv ORA_NLS33 ${ORACLE_HOME}/xdk/mesg
If no Oracle database is installed, you can set it to be the directory of the error message files that come with the XDK release:
setenv ORA_NLS33 ${XDK_HOME}/xdk/mesg
Currently, all of the message files are in English. The message files for other languages will be provided in a future release.
Now you can use the Makefile to compile and link the demo code.
After installation, the directory structure is:
-$XDK_HOME | - bin: executable files and dynamic libraries | - lib: static library files. |- nlsdata: Globalization Support data files (*.nlb) | - xdk | - demo: demonstration code | - doc: documents including release notes. | - include: header files. | - mesg: message files. (*.msb)
These are the Widows NT libraries that come with the XDK for C:
Component | Library | Notes |
---|---|---|
XSL Processor |
oraxml9.dll |
XML Parser V2 for C, which includes DOM, SAX, and XSLT APIs |
XML Schema Processor |
oraxsd9.dll |
XML Schema Processor for C |
The XDK for C (NT) depends on the Oracle CORE and Globalization Support libraries in the following table:
Component | Library | Notes |
---|---|---|
CORE Library |
oracore9.a |
Oracle CORE library |
Globalization Support Library |
oranls9.dll |
|
oraunls9.dll |
Oracle Globalization Support library for Unicode support |
Check that the environment variable ORA_NLS33 is set to point to the location of the Globalization Support data files.
If you install the Oracle database, you can set it this way:
set ORA_NLS33 =%ORACLE_HOME%\nlsrtl\admin\nlsdata
If no Oracle database is installed, you can set use the Globalization Support data files that come with the XDK release:
set ORA_NLS33 =%XDK_HOME%\nlsdata
You must check if the environment variable ORA_XML_MESG is set to point to the absolute path of the mesg
directory.
If you install the Oracle database, you can set it to be:
set ORA_NLS33 =%ORACLE_HOME%\xdk\mesg
If no Oracle database is installed, you can set it to be the directory of the error message files that come with the XDK release:
set ORA_NLS33 =%XDK_HOME%\xdk\mesg
Currently, all of the message files are in English. The message files for other language will be provide in a future release.
Set the path for the cl
compiler (if you need to compile the code using a Make.bat) in command line environment.
Go to the Start Menu and select Settings > Control Panel. In the pop-up window of Control Panel, select System icon and double click. A window named System Properties will be popped up. Select Environment Tab and input the path of cl.exe
to the PATH variable shown in Figure 3-1, "Setting the Path for the cl Compiler in NT".
cl
Compiler in NTText description of the illustration c2.gif
You need to update the Make.bat
by adding the path of the libraries and the header files to the compile and link commands as shown in the following example of a Make.bat
file:
... :COMPILE set filename=%1 cl -c -Fo%filename%.obj %opt_flg% /DCRTAPI1=_cdecl /DCRTAPI2=_cdecl /nologo /Zl /Gy /DWIN32 /D_WIN32 /DWIN_NT /DWIN32COMMON /D_DLL /D_MT /D_X86_=1 /Doratext=OraText -I. -I..\..\..\include -ID:\Progra~1\Micros~1\VC98\Include
%filename%.c goto :EOF :LINK set filename=%1 link %link_dbg% /out:..\..\..\..\bin\%filename%.exe /libpath:%ORACLE_HOME%\lib/libpath:D:\Progra~1\Micros~1\VC98\lib
/libpath:..\..\..\..\lib %filename%.obj oraxml9.lib oracore9.lib oranls9.lib oraunls9.lib user32.lib kernel32.lib msvcrt.lib ADVAPI32.lib oldnames.lib winmm.lib :EOF
where:
D:\Progra~1\Micros~1\VC98\Include:
is the path for header files and D:\Progra~1\Micros~1\VC98\lib:
is the path for library files.
If you are using Microsoft Visual C++ for your compiler:
Check that the environment variable ORA_NLS33 is set to point to the location of the Globalization Support data files.
If you install the Oracle database, you can set it to be:
set ORA_NLS33 =%ORACLE_HOME%\nlsrtl\admin\nlsdata
If no Oracle database is installed, you can use the Globalization Support data files that come with the XDK release:
set ORA_NLS33 =%XDK_HOME%\nlsdata
In order to use Visual C++, you need to employ the system setup for Windows NT to define the environment variable.
Go to Start Menu and select Settings > Control Panel. In the pop up window of Control Panel, select System icon and double click. A window named System Properties will pop up. Select Environment Tab and input ORA_NLS33.
Text description of the illustration c3.gif
Check that the environment variable ORA_XML_MESG is set to point to the absolute path of the mesg
directory.
If you install the Oracle database, you can set it to be:
set ORA_NLS33 =%ORACLE_HOME%\xdk\mesg
If no Oracle database is installed, you can set it to be the directory of the error message files that come with the XDK release:
set ORA_NLS33 =%XDK_HOME%\xdk\mesg
In order for Visual C++ to use the environment variable, you need to employ the system setup for windows NT to define the environment variable.
Go to the Start Menu and select Settings > Control Panel. In the pop-up window of Control Panel, select System icon and double click. A window named System Properties will be popped up. Select Environment Tab and input ORA_XML_MESG.
Text description of the illustration c4.gif
Currently, all the message files are in English. The message files for other languages will be provided in future releases.
The following figure shows the setup of the PATH for DLLs:
Text description of the illustration c5a.gif
After you open a workspace in Visual C++ and include the *.c
files for your project, you must set the path for the project. Go to the Tools menu and select Options. A window will pop up. Select the Directory tab and set your include path as shown in the following figure:
Text description of the illustration c6.gif
Then set your library path as shown in the following figure:
Text description of the illustration c7.gif
After setting the paths for the static libraries in %XDK_HOME\lib, you also need to set the library name in the compiling environment of Visual C++.
Go to the Project menu in the menu bar and select Settings. A window will pop up. Please select the Link tab in the Object/Library Modules field enter the name of XDK for C libraries:
Text description of the illustration cpp8.gif
Compile and run the demo programs, and then start using XDK for C.
See Also:
Chapter 13, "XML Parser for C" for further discussion of the XDK for C components. |
XDK for C++ contains the basic building blocks for reading, manipulating, transforming XML documents.
Oracle XDK for C consists of the following components:
.xsd
).If you have installed the Oracle database or iAS (Application Server), you will already have the XDK for C++ installed.
You can also download the latest versions of XDK for C++ from OTN.
In order to download the XDK from OTN, follow these steps:
http://otn.oracle.com/tech/xml/xdk_cpp/content.html
Refer to "Getting Started with XDK for Java and JavaBeans" for the details of downloading an XDK (use XDK for C++).
After installing the XDK, the directory structure is:
-$XDK_HOME | - bin: executable files | - lib: library files. |- nlsdata: Globalization Support data files(*.nlb) | - xdk | - demo: demonstration code | - doc: documents including release notes. | - include: header files. | - mesg: message files. (*.msb)
The libraries that come with the UNIX version of XDK for C++ are listed in the following table:
The XDK for C++ package depends on the Oracle CORE and Globalization Support libraries, which are listed in the following table:
Check that the environment variable ORA_NLS33 is set to point to the location of the Globalization Support data files.
If you install the Oracle database, you can set it to be:
setenv ORA_NLS33 ${ORACLE_HOME}/ocommon/nls/admin/data
If no Oracle database is installed, you can use the Globalization Support data files that come with the XDK release:
setenv ORA_NLS33 ${XDK_HOME}/nlsdata
Check that the environment variable ORA_XML_MESG is set to point to the absolute path of the mesg
directory.
If you install the Oracle database, you can set it to be:
setenv ORA_NLS33 ${ORACLE_HOME}/xdk/mesg
If no Oracle database is installed, you can set it to be the directory of the error message files that comes with the XDK release:
setenv ORA_NLS33 ${XDK_HOME}/xdk/mesg
Currently, all of the message files are in English. The message files for other languages will be provided in a future release.
You can now use the Makefiles to compile and link the demo code and start developing your program using XDK for C++ on a UNIX platform.
After installation, the directory structure is:
-$XDK_HOME | - bin: executable files and dynamic libraries | - lib: static library files. |- nlsdata: Globalization Support data files (*.nlb) | - xdk | - demo: demonstration code | - doc: documents including release notes. | - include: header files. | - mesg: message files. (*.msb)
These are the Widows NT libraries that come with the XDK for C++:
The XDK for C++ (NT) depends on the Oracle CORE and Globalization Support libraries in the following table:
Component | Library | Notes |
---|---|---|
CORE Library |
oracore9.dll |
Oracle CORE library |
Globalization Support Library |
oranls9.dll |
|
oraunls9.dll |
Oracle Globalization Support library for Unicode support |
Check that the environment variable ORA_NLS33 is set to point to the location of the Globalization Support data files.
If you install the Oracle database:
set ORA_NLS33 =%ORACLE_HOME%\nlsrtl\admin\nlsdata
If no Oracle database is installed, you can use the Globalization Support data files that come with the XDK release:
set ORA_NLS33 =%XDK_HOME%\nlsdata
Check that the environment variable ORA_XML_MESG is set to point to the absolute path of the mesg
directory.
If you install the Oracle database, you can set it to be:
set ORA_NLS33 =%ORACLE_HOME%\xdk\mesg
If no Oracle database is installed, you can set it to be the directory of the error message files, which comes with the XDK release:
set ORA_NLS33 =%XDK_HOME%\xdk\mesg
Currently, all of the message files are in English. The message files for other languages will be provided in a future release.
Set the path for cl
compiler, if you need to compile the code using make.bat
in a command line.
Go to the Start Menu and select Settings > Control Panel. In the pop up window of Control Panel, select System icon and double click. A window named System Properties will pop up. Select Environment Tab and input the path of cl.exe
to the PATH variable shown in Figure 3-8, "Setting the PATH for the cl Compiler".
Text description of the illustration cpp2.gif
You must update the file Make.bat
by adding the path of the libraries and header files to the compile and link commands:
... :COMPILE set filename=%1 cl -c -Fo%filename%.obj %opt_flg% /DCRTAPI1=_cdecl /DCRTAPI2=_cdecl /nologo /Zl /Gy /DWIN32 /D_WIN32 /DWIN_NT /DWIN32COMMON /D_DLL /D_MT /D_X86_=1 /Doratext=OraText -I. -I..\..\..\include -ID:\Progra~1\Micros~1\VC98\Include
%filename%.c goto :EOF :LINK set filename=%1 link %link_dbg% /out:..\..\..\..\bin\%filename%.exe /libpath:%ORACLE_HOME%\lib/libpath:D:\Progra~1\Micros~1\VC98\lib
/libpath:..\..\..\..\lib %filename%.obj oraxml9.lib oracore9.lib oranls9.lib oraunls9.lib user32.lib kernel32.lib msvcrt.lib ADVAPI32.lib oldnames.lib winmm.lib :EOF ...
where
D:\Progra~1\Micros~1\VC98\Include:
is the path for header files and D:\Progra~1\Micros~1\VC98\lib:
is the path for library files.
Now you can start developing with XDK for C++.
Check that the environment variable ORA_NLS33 is set to point to the location of the Globalization Support data files.
If you install the Oracle database, you can set it to be
set ORA_NLS33 =%ORACLE_HOME%\nlsrtl\admin\nlsdata
If no Oracle database is installed, you can use the Globalization Support data files that come with the XDK release:
set ORA_NLS33 =%XDK_HOME%\nlsdata
In order for Visual C++ to know the environment variable, you need to use the system setup for windows NT to define the environment variable.
Go to Start Menu and select Settings > Control Panel. In the pop-up window of Control Panel, select System icon and double click. A window named System Properties will be popped up. Select Environment Tab and input ORA_NLS33.
Text description of the illustration cpp3.gif
Check that the environment variable ORA_XML_MESG is set to point to the absolute path of the mesg
directory.
If you install the Oracle database, you can set it:
set ORA_NLS33 =%ORACLE_HOME%\xdk\mesg
If no Oracle database is installed, you can set it to be the directory of the error message files that comes with the XDK release:
set ORA_NLS33 =%XDK_HOME%\xdk\mesg
In order for Visual C++ to employ the environment variable, you need to use the system setup for Windows NT to define the environment variable.
Go to the Start Menu and select Settings > Control Panel. In the pop-up window of Control Panel, select System icon and double click. A window named System Properties will pop up. Select Environment Tab and input the ORA_XML_MESG.
Text description of the illustration cpp4.gif
Currently, all of the message files are in English. The message files for other languages will be provided in a future release.
Text description of the illustration c5.gif
After you open a workspace in Visual C++ and include the *.c
files for your project, you must set the path for the project. Go to the Tools menu and select Options. A window will pop up. Select the Directory tab and set your include path as shown in the following figure:
Text description of the illustration c6.gif
Then set your library path as shown in the following figure:
Text description of the illustration c7.gif
After setting the paths for the static libraries in %XDK_HOME\lib, you also need to set the library name in the compiling environment of Visual C++.
Go to the Project menu in the menu bar and select Settings. A window will pop up. Please select the Link tab in the Object/Library Modules field enter the name of XDK for C++ libraries:
Text description of the illustration cpp8.gif
You can now compile and run the demo programs, and start using XDK for C++.
See Also:
Chapter 16, "XML Parser for C++" for further discussion of the XDK for C++ components |
XDK for PL/SQL contains the basic building blocks for reading, manipulating, and transforming XML documents. Oracle XDK for PL/SQL consists of the following components:
If you have installed the Oracle database or iAS (Application Server), you will already have the XDK for PL/SQL installed.
You can also download the latest versions of XDK for PL/SQL from OTN.
In order to download the XDK from OTN, follow these steps:
http://otn.oracle.com/tech/xml/xdk_plsql/content.html
Refer to "Getting Started with XDK for Java and JavaBeans" for the details of downloading an XDK (using the XDK for PL/SQL).
After installing the XDK, the directory structure is:
-$XDK_HOME | - bin: executable files and setup script/batch files. | - lib: library files. | - xdk: | - admin: (Administration): XSU PL/SQL API setup SQL script and XSL Servlet Configuration file(XSQLConfig.xml). | - demo: demonstration code | - doc: documents including release notes and javadocs.
The following table lists all the Java libraries that come with XDK for PL/SQL:
The PL/SQL packages provided are listed in the following table:
Before installing the XDK for PL/SQL packages into the database, you need to check the status of the packages and the related Java libraries.
You can use the following command to check if any of the PL/SQL packages is in your current database schema:
SQL*PLUS> desc package_name
For example:
SQL*PLUS> desc xmldom
If you see the content of the package, then the package is available to be used in your schema and you can skip all of the rest of the installation steps.
If you see the following error messages:
SQL> desc xmldom ERROR: OrA-04043: object "SYS"."XMLDOM" does not exists.
it means that the XDK for PL/SQL packages have not been defined in your database schema. You need to do the status checking for the related Java libraries.
The libraries, including xmlparserv2.jar
, xmlplsql.jar
and xsu12.jar
(or xsu111.jar
), are required to be loaded to the database. You can use SQL commands to check the status of a specific library by the classes that the library contains.
For example, to check the status of xmlparserv2.jar, you can check the classes within oracle.xml.parser.v2.DOMParser class by using the following SQL statement:
SELECT SUBSTR(dbms_java.longname(object_name),1,35) AS class, status FROM all_objects WHERE object_type = 'JAVA CLASS' AND object_name = dbms_java.shortname('oracle/xml/parser/v2/DOMParser');
If you see the result:
CLASS STATUS ------------------------------------------------------- oracle/xml/parser/v2/DOMParser INVALID
then try the command:
ALTER JAVA CLASS _oracle/xml/parser/v2/DOMParser Resolve
If the verification procedure produces the SQL*Plus message "no rows selected", you need to use the XDKLOAD
utility in "Loading XDK for PL/SQL".
If you see the preceding result, but the status is VALID, that means the Oracle XML Parser for Java is already installed and ready to be used. If all of the Java libraries have already been loaded into the database, then you can run the SQL scripts to define the PL/SQL packages.
For SYS users who would like to create public synonyms in addition to the packages:
For XML Parser and PL/SQL:
$XDK_HOME/xdk/admin/xmlpkg.sql $XDK_HOME/xdk/admin/xmlsyn.sql
For XSU:
$XDK_HOME/xdk/admin/xsupkg.sql $XDK_HOME/xdk/admin/xsusyn.sql
For all other users:
For XML Parser and PL/SQL:
$XDK_HOME/xdk/admin/xmlpkg.sql
For XSU:
$XDK_HOME/xdk/admin/xsupkg.sql
If any single library is not valid you can load the package by directly using the load Java utility:
loadjava -resolve -verbose -user xdktemp/xdktemp xmlparserv2.jar
Before using LOADJAVA
utility to load the Java libraries into the database schema, you need to get the Java VM properly installed. You have to run the INITJVM.SQL
and INITDBJ.SQL
scripts to initialize the Java environment before running the LOADJAVA
utility. Usually these are in the $ORACLE_HOME/javavm/install
subdirectory of your Oracle Home directory.
To load the XDK for PL/SQL packages into the database schema, you can use the script or batch files provided by XDK.
UNIX:
$XDK_HOME/bin/xdkload
Windows:
$XDK_HOME/bin/xdkload.bat
The xdkload
command syntax is:
xdkload -u username/password [-s] [-noverify] [-dbver] -s Creates public synonyms for the loaded java APIs; this can be invoked only if the target user has dba privileges. -noverify Use this if you are loading into an older version of the db and ar running into an error about missing method (for example, if you are loading xsu version 9.0.1.0.0 into Oracle 8.1.7). -dbver Used to specify the version of the database into which you are loading XDK. This is a must if Oracle older than the version of the XDK). This option also sets the -noverify option.
For example:
xdkload -u "system/manager" -s -dbver "816"
This example uses xdkload to load the XDK for PL/SQL packages to system user.
Before using xdkload, you need to check if any of the libraries including xmlparserv2.jar
, xmlxsql.jar
and xsu12.jar
(xsu111.jar
) is already loaded to the database. If so, you need to drop them before using xdkload
:
dropjava -verbose -user xdktemp/xdktemp xmlparserv2.jar xschema.jar
Moreover, you need to set up the environment variables by using the script or batch file XDK provides:
UNIX:
$XDK_HOME/bin/env.csh
Windows:
$XDK_HOME/bin/env.bat
You can refer to "Getting Started with XDK for Java and JavaBeans" for the detailed information of this environment setup.
After running the xdkload
script or batch file, if the target user name used to run xdkload
has DBA privileges, then the XDK for PL/SQL package will be available to all the users and the public synonyms for the PL/SQL packages are also created. Otherwise, the XDK for PL/SQL packages will be available only to the target user.
See Also:
Chapter 20, "XML Parser for PL/SQL" or further discussion of the XDK for PL/SQL components |
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|