gtpx1m0hXML User's Guide

Samples from the Source: XML4C

XML Parser for C++ (XML4C) version 3.5.1 contains sample programs to help you understand how the APIs work as well as the differences between DOM and SAX.

As noted in the Migration Information (MAKE THIS A LINK), the actual XML4C code that was ported to the TPF 4.1 system has been included for your information only. If the XML4C tar file has been extracted and placed onto your OS/390 UNIX System Services (OS390 UNIX) system, you may choose to install the samples that come with XML4C on TPF.

The following instructions guide you through the process of installing and running the XML4C samples on TPF.

On your OS/390 UNIX system and do the following:

  1. To define the value for the variable XERCESCROOT, enter: export XERCESCROOT="/dirname" where dirname is the full path to the directory in which the XML4C tar file was extracted. The directory specified for dirname will contain a subdirectory called samples. The XERCESCROOT variable is used in the configure and make processes; do not change the name XERCESCROOT.
  2. To configure the samples for your TPF 4.1 system, do the following:
    1. Enter chmod -R 777 $XERCESCROOT to set the correct permission values for the files in the samples directory.
    2. Enter cd $XERCESCROOT/samples to change your directory to the samples directory.
    3. Enter export USE_TPF_MAKEFILES=true to create the environment variable.
    4. Enter configure --cache-file=/dev/null local-ibm-tpf to begin the configure process.
  3. To compile the samples, do the following:
    1. Enter the following export commands: (After you enter these export commands, you cannot go back to the configure step without first exiting your OS390 UNIX session.)
      Note:
      You may need to change these export commands to match your development environment.
      • export _C89_CCMODE=1
      • export _CXX_INCDIRS="$XERCESCROOT/include /u/tpf41/currentmaint/include"
        (Enter the entire command as a single line.)
        Note:
        _CXX_INCDIRS must contain the directory where the TPF system header files are as well as the directory that contains the extracted XML4C header files.
      • export _C89_INCDIRS="$_CXX_INCDIRS"
      • export _CXX_INCLIBS=""
      • export _C89_INCLIBS=""
      • export _CXX_CSYSLIB=""
      • export _C89_CSYSLIB=""
      • export _CXX_CXXSUFFIX="cpp"
      • export _CXX_OPTIONS="-W 0,langlvl(extended) -W0,NOSTART -D_POSIX_SOURCE -Uerrno -DTPF"
        (Enter the entire command as a single line.)
    2. Enter cd $XERCESCROOT/samples to ensure you are in the samples directory.
    3. Enter make to begin the compiling process. The following warning may be issued when compiling the sample programs using the OP2 (-2) compiler option; it is expected and can be ignored:

      WARNING CBC5109: Infinite loop detected in function xxx::fatalError(const SAXParseException&). Program may not stop.
      		
      
  4. To link the samples, do the following:
  5. Create a loadset for the samples you linked in the previous step.

    On a TPF 4.1 test system, complete the remaining steps:

  6. To set up a test system, do the following:
    1. Ensure you do not have the hash (#) and double quotation (") key strokes mapped to have special meanings. For example, if you use eNetwork Personal Communications as your emulator, you can enter q term at the CP prompt to determine if these two symbols are mapped to special meanings or not.
    2. To associate the names of the sample drivers with each respective program name, use the ZFILE echo and ZFILE chmod commands. An example of what to enter for each sample is included in the following list. The CXM names are only examples; use the same names that you used in step 4 when you linked each sample. Note: The following ZFILE entries are case-sensitive.
      • ZFILE echo "#!CXMA" > /bin/CreateDOMDocument ZFILE chmod 777 /bin/CreateDOMDocument
      • ZFILE echo "#!CXMB" > /bin/DOMCount ZFILE chmod 777 /bin/DOMCount
      • ZFILE echo "#!CXMC" > /bin/DOMPrint ZFILE chmod 777 /bin/DOMCount
      • ZFILE echo "#!CXMD" > /bin/EnumVal ZFILE chmod 777 /bin/EnumVal
      • ZFILE echo "#!CXME" > /bin/MemParse ZFILE chmod 777 /bin/MemParse
      • ZFILE echo "#!CXMF" > /bin/PParse ZFILE chmod 777 /bin/PParse
      • ZFILE echo "#!CXMG" > /bin/Redirect ZFILE chmod 777 /bin/Redirect
      • ZFILE echo "#!CXMH" > /bin/SAXCount ZFILE chmod 777 /bin/SAXCount
      • ZFILE echo "#!CXMI" > /bin/SAXPrint ZFILE chmod 777 /bin/SAXPrint
      • ZFILE echo "#!CXMJ" > /bin/StdInParse ZFILE chmod 777 /bin/StdInParse
      • ZFILE echo "#!CXMN" > /bin/IDOMCount ZFILE chmod 777 /bin/IDOMCount
      • ZFILE echo "#!CXMO" > /bin/IDOMPrint ZFILE chmod 777 /bin/IDOMPrint
      • ZFILE echo "#!CXMP" > /bin/SAX2Count ZFILE chmod 777 /bin/SAX2Count
      • ZFILE echo "#!CXMQ" > /bin/SAX2Print ZFILE chmod 777 /bin/SAX2Print
    3. Load and activate the new loadsets.
    4. TFTP or FTP the following documents from $XERCESCROOT/samples/data to your test system using binary mode:
      • personal.xml
      • personal.dtd
      • redirect.dtd
  7. To run the samples, enter each of the following commands. (These commands are case-sensitive.) Each entry is accompanied by the output. Note: Some characters may be displayed differently because of console restrictions.