Skip Headers
Oracle® XML Developer's Kit Programmer's Guide
10g Release 2 (10.1.2)
Part No. B14033-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

17 Getting Started with XDK C++ Components

This chapter contains this topic:

Installation of the XDK C++ Components

XDK C++ components are the basic building blocks for reading, manipulating, and transforming XML documents.

Oracle XDK C++ components consist of the following:

Getting the C++ Components of XDK

If you have installed the Oracle Database or Oracle Application Server, you will already have the XDK C++ components installed. You can also download the latest versions of XDK C++ components from OTN.

In order to download the XDK from OTN, follow these steps:

  1. Go to the URL http://www.oracle.com/technology/tech/xml/

  2. Click the XML Developer's Kit link.

  3. Logon with your OTN username and password (registration is free if you don't already have an account).

  4. Select the version that you want to download.

  5. Accept all conditions in the licensing agreement.

  6. Click the appropriate *.tar.gz or *.zip file.

  7. Extract the files in the distribution:

    1. Choose a directory under which you would like the xdk directory and subdirectories to go.

    2. Change to that directory; then extract the XDK download archive file with the tool:

      UNIX: tar xvfz xdk_xxx.tar.gz  
      Windows: use WinZip visual archive extraction tool
      

Libraries in the UNIX Environment for C++ XDK

After installing the XDK, the directory structure is:

-$XDK_HOME 
     | - bin: executable files 
     | - lib: library files. 
     | - nls/data: Globalization Support data files(*.nlb) 
     | - xdk 
          | - demo/cpp: demonstration code 
          | - doc/cpp: documentation 
          | - public: header files 
          | - mesg: message files (*.msb) 

The libraries that come with the UNIX version of XDK C++ components are listed in the following table:

Table 17-1 XDK Libraries for C++ (UNIX)

Component Library Notes
XML Parser, XSL Processor, XML Schema Processor,

Class Generator

libxml10.a
XML Parser V2 for C++, which includes DOM, SAX, and XSLT APIs, XML Schema Processor for C++, Class Generator for C++

The XDK C++ components package depends on the Oracle CORE and Globalization Support libraries, which are listed in the following table:

Table 17-2 Dependent Libraries of XDK C++ Components on UNIX

Component Library Notes
CORE Library
libcore10.a
Oracle CORE library
Globalization Support Library
libnls10.a
Oracle Globalization Support common library
Globalization Support Library
libunls10.a 
Oracle Globalization Support library for Unicode support

Setting the UNIX Environment for C++

Check that the environment variable ORA_NLS10 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_NLS10 ${ORACLE_HOME}/nls/data

If no Oracle database is installed, you must use the Globalization Support data files that come with the XDK release:

setenv ORA_NLS10 ${XDK_HOME}/nls/data

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, although this is not required, you can set it to:

setenv ORA_XML_MESG ${ORACLE_HOME}/xdk/mesg

If no Oracle database is installed, you must set it to be the directory of the error message files that comes with the XDK release:

setenv ORA_XML_MESG ${XDK_HOME}/xdk/mesg

The XDK components can be invoked by writing your own programs to use the supplied API. Compile the programs using the headers in the xdk/include/ subdirectory and link against the libraries in the lib/ subdirectory. See Makefile in the xdk/demo/ subdirectory for full details of how to build your programs.

Command Line Environment Setup

The parser may be called as an executable by invoking bin/xml, which has the following options:


See Also:

For information about Command Line Parser usage, see Table 13-3, "Parser Command Line Options"

To get the XDK version you are using on UNIX:

strings libxml10.a | grep -i Version

You can now use the Makefiles to compile and link the demo code and start developing your program using XDK C++ components.

Windows Environment Setup for C++ XDK

These are the Windows libraries that come with the XDK C++ components:

Table 17-3 XDK C++ Components Libraries on Windows

Component Library Notes
XML Parser

XSL Processor

XML Schema Processor

Class Generator

oraxml10.lib
oraxml10.dll
XML Parser V2 for C++, which includes DOM, SAX, and XSLT APIs

XML Schema Processor for C++

Class Generator for C++


The XDK C++ components (Windows) depends on the Oracle CORE and Globalization Support libraries in the following table:

Table 17-4 Dependent Libraries of XDK C++ Components on Windows

Component Library Notes
CORE Library
oracore10.dll
Oracle CORE library
Globalization Support Library
oranls.dll
Oracle Globalization Support common library

Globalization Support Library
oraunls.dll
Oracle Globalization Support library for Unicode support

Environment for Command Line Usage on Windows

Check that the environment variable ORA_NLS10 is set to point to the location of the Globalization Support data files. If you install the Oracle database:

set ORA_NLS10 = %ORACLE_HOME%\nls\data

If no Oracle database is installed, you must use the Globalization Support data files that come with the XDK release:

set ORA_NLS10 =%XDK_HOME%\nls\data

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, although it is not required, you can set it to:

set ORA_XML_MESG =%ORACLE_HOME%\xdk\mesg

If no Oracle database is installed, you must set it to be the directory of the error message files, which comes with the XDK release:

set ORA_XML_MESG =%XDK_HOME%\xdk\mesg

See Also:

For information about Command Line Parser usage, see Table 13-3, "Parser Command Line Options"

Setting the Windows Environment for C++ XDK

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 17-1.

Figure 17-1 Setting the PATH for the cl Compiler

Description of cpp2.gif follows
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
oraxml10.lib oracore10.lib oranls10.lib oraunls10.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 C++ components.

Using XDK C++ Components with Visual C++

Check that the environment variable ORA_NLS10 is set to point to the location of the Globalization Support data files.

In order for Visual C++ to know the environment variable, you need to use the system setup for Windows 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_NLS10.

In order for Visual C++ to employ the environment variable, you need to use the system setup for Windows 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, as shown in Figure 17-2:

Figure 17-2 Setting Up ORA_XML_MESG Environment Variable

Description of cpp4.gif follows
Description of the illustration cpp4.gif

Figure 17-3, "Setup of the PATH for DLLs" shows how to set up the PATH for DLL libraries:

Figure 17-3 Setup of the PATH for DLLs

Description of cpp5.gif follows
Description of the illustration cpp5.gif

After you open a workspace in Visual C++ and include the *.cpp 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 Figure 17-4:

Figure 17-4 Setting Your Include Path in Visual C++

Description of cpp6.gif follows
Description of the illustration cpp6.gif

Then set your library path as shown in Figure 17-5:

Figure 17-5 Setting Your Static Library Path in Visual C++

Description of cpp7.gif follows
Description of the illustration cpp7.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 C++ components libraries, as shown in Figure 17-6:

Figure 17-6 Setting Up the Static Libraries in Visual C++ Project

Description of cpp8.gif follows
Description of the illustration cpp8.gif

You can now compile and run the demo programs, and start using XDK C++ components.


See Also:

Chapter 19, "XML Parser for C++" for further discussion of the XDK C++ components