Skip Headers

Oracle9i Application Developer's Guide - XML
Release 1 (9.0.1)

Part Number A88894-01
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

25
Using XML Schema Processor for C

This chapter contains the following sections:

Oracle XML Schema Processor for C

The XML Schema Processor for C is a companion component to the XML Parser for C. It allows support for simple and complex datatypes in Oracle9i XML applications.

XML Schema Processor for C supports the W3C XML Schema Working Draft, with the goal being that it be 100% fully conformant when XML Schema becomes a W3C Recommendation. This makes writing custom applications that process XML documents straightforward in the Oracle9i environment, and means that a standards-compliant XML Schema Processor is part of the Oracle9i platform on every operating system where Oracle9i is ported.

See Also:

Chapter 21, "Using XML Schema Processor for Java", for more information about XML Schema and why you would want to use XML Schema. 

Oracle XML Schema for C Features

XML Schema Processor for C has the following features:

Requirements

XML Schema Processor for C runs on the following operating systems:

Online Documentation

Documentation for Oracle XML Schema Processor for C is located in the doc/ directory in your install area.

Standards Conformance

Oracle XML Parser for C conforms to the following standards:

Using the Supported Character Sets

The XML Parser for C currently supports the following encodings:

To use these encodings, you must have the following set:

The default encoding is UTF-8. It is recommended that you set the default encoding explicitly if using only single byte character sets (such as US-ASCII or any of the ISO-8859 character sets) for performance up to twice as fast as with multibyte character sets, such as UTF-8.

XML Schema Processor for C: Software

Table 25-1 lists the supplied files and directories with this release:

Table 25-1 XML Schema Processor for C: Supplied Files
Directory an d Files  Description 

license.html 

Licensing agreement  

readme.html 

This file  

bin/ 

Schema processor executable, "schema"  

doc/ 

API documentation  

include/ 

header files  

lib/ 

XML/XSL/Schema & support libraries  

mesg/ 

Error message files  

sample/ 

Example usage of the Schema processor  

Table 25-2 lists the included libraries:

Table 25-2 XML Schema Processor for C: Supplied Libraries
Included Library  Description 

libxml8.a 

XML Parser/XSL Processor  

libxsd8.a 

XML Schema Processor  

libcore8.a 

CORE functions  

libnls8.a 

National Language Support  

Invoking XML Schema Processor for C

XML Schema Processor for C can be called as an executable by invoking bin/schema in the install area. This takes two arguments:

The Schema Processor can also be invoked by writing code using the supplied APIs. The code must be compiled using the headers in the include/ subdirectory and linked against the libraries in the lib/ subdirectory. See Makefile in the sample/ subdirectory for details on how to build your program.

An error message file is provided in the mesg/ subdirectory. Currently, the only message file is in English although message files for other languages may be supplied in future releases.

Set Environment Variable OR_XML_MESG to Point to Absolute Path

You should set the environment variable ORA_XML_MESG to point to the "absolute" path of the mesg/ subdirectory. Alternately, if you have an $ORACLE_HOME installed, you may copy the contents of the mesg/ subdirectory to the $ORACLE_HOME/oracore/mesg directory.

XML Schema Processor for C Usage Diagram

Figure 25-1 describes the calling sequence for the XML Schema Processor for C, as follows:

The sequence of calls to the processor is: initialize, validate, validate,..., validate, terminate.

  1. The initialize call is invoked once at the beginning of a session; it returns a Schema context which is used throughout the session.

  2. The instance document to be validated is first parsed with the XML parser.

  3. The XML context for the instance is then passed to the Schema validate function, along with an optional schema URL.

  4. If no explicit schema is defined in the instance document, the default schema will be used.

  5. More documents may then be validated using the same schema context.

  6. When the session is over, the Schema tear down function is called, which releases all memory allocated by the loaded schemas.

Figure 25-1 XMLSchema Processor for C Usage Diagram


Text description of adxml092.gif follows
Text description of the illustration adxml092.gif

How to Run XML Schema for C Sample Programs

This directory contains a sample XML Schema application that illustrates how to use Oracle XML Schema Processor with its API. Table 25-3 lists the provided sample files.

Table 25-3 XML Schema for C Samples Provided
Sample File  Description 

Makefile 

Makefile to build the sample programs and run them, verifying correct output. 

xsdtest.c 

Trivial program which invokes the XML Schema for C API 

car.{xsd,xml,std}

 

Sample schema, instance document, and expected output respectively, after running xsdtest on them. See:

"XML Schema for C Example 2: car.xsd"

"XML Schema for C Example 3: car.xml"

"XML Schema for C Example 4: car.std"

aq.{xsd,xml,std}

 

Second sample schema, instance document, and expected output respectively, after running xsdtest on them. See:

"XML Schema for C Example 5: aq.xsd"

"XML Schema for C Example 6: aq.xml"

"XML Schema for C Example 7: aq.std"  

pub.{xsd,xml,std}

 

Third sample schema, instance document, and expected output respectively, after running xsdtest on them. See:

"XML Schema for C Example 8: pub.xsd"

"XML Schema for C Example 9: pub.xml"

"XML Schema for C Example 10: pub.std"  

To build the sample programs, run 'make'.

To build the programs and run them, comparing the actual output to expected output, run 'make sure'.

Make.bat

:: ##########################################################################
:: # Batch script to build Oracle XML parser C sample programs
:: ##########################################################################
set opt_flg=-Ox -Oy-
if (%2) == (D) set opt_flg=-Z7 -Od
if (%2) == (D) set link_dbg=/debug /debugtype:both /pdb:none

if (%1) == () goto :XSDTEST
if (%1) == (all) goto :XSDTEST
if (%1) == (xsdtest) goto :XSDTEST
if (%1) == (clean) goto :CLEAN
if (%1) == (sure) goto :SURE
goto :EOF

:CLEAN
del *.obj
del *.out
del ..\bin\xsdtest.exe
goto :EOF

:XSDTEST
call :compile xsdtest
call :link xsdtest
if (%1) == (xsdtest) goto :EOF

:SURE
..\bin\xsdtest.exe car.xml > car.out
comp car.std car.out < NUL:
..\bin\xsdtest.exe pub.xml > pub.out
comp pub.std pub.out < NUL:
..\bin\xsdtest.exe aq.xml > aq.out
comp aq.std aq.out < NUL:
goto :EOF

: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 -I. 
-I..\include  %filename%.c
goto :EOF

:LINK 
set filename=%1
link %link_dbg% /out:..\bin\%filename%.exe /libpath:%ORACLE_HOME%\lib 
/libpath:..\lib  %filename%.obj oraxml8.lib oraxsd8.lib oracore8.lib oranls8.lib 
user32.lib kernel32.lib msvcrt.lib ADVAPI32.lib oldnames.lib winmm.lib

:EOF

XML Schema for C Example 1: xsdtest.c

/* Copyright (c) Oracle Corporation 1999, 2000. All Rights Reserved. */
 
/*
   NAME
     validate.c - Sample Schema validation
 
   DESCRIPTION
     Sample usage of C XML Schema processor
*/
 
#include <stdio.h>

#ifndef ORATYPES
# include <oratypes.h>
#endif
 
#ifndef ORAXML_ORACLE
# include <oraxml.h>
#endif
 
#ifndef ORAXSD_ORACLE
# include <oraxsd.h>
#endif
 
int main(int argc, char **argv)
{
    xmlctx     *ctx;
    xsdctx     *scctx;
    char       *doc, *schema;
    uword       ecode;
 
    puts("XML C Schema processor");

    if ((argc < 2) || (argc > 3))
    {
	puts("usage: validate <xml document> [schema]");
	return -1;
    }
    doc = argv[1];
    schema = (argc > 2) ? argv[2] : 0;

    puts("Initializing XML package...");
 
    if (!(ctx = xmlinit(&ecode, (const oratext *) 0,
                        (void (*)(void *, const oratext *, uword)) 0, 
                        (void *) 0, (const xmlsaxcb *) 0, (void *) 0,
                        (const xmlmemcb *) 0, (void *) 0, 
                        (const oratext *) 0)))
    {
        printf("Failed to initialze XML parser, error %u\n", (unsigned) ecode);
        return 1;
    }

    printf("Parsing '%s' ...\n", doc);
    if (ecode = xmlparse(ctx, (oratext *) doc, (oratext *) 0,
			 XML_FLAG_DISCARD_WHITESPACE))
    {
        printf("Parse failed, error %u\n", (unsigned) ecode);
        return 2;
    }

    puts("Initializing Schema package...");

    if (!(scctx = schemaInitialize(ctx, &ecode)))
    {
	printf("Failed, code %u!\n", ecode);
	return 3;
    }

    puts("Validating document...");
    if (ecode = schemaValidate(scctx, ctx, (oratext *) schema))
    {
        printf("Validation failed, error %u\n", (unsigned) ecode);
        return 4;
    }

    puts("Document is valid.");
    return 0;
}

XML Schema for C Example 2: car.xsd

<?xml version="1.0"?>
<schema xmlns = "http://www.w3.org/1999/XMLSchema"
        targetNamespace = "http://www.CarDealers.com/">
    <element name="Car">
	<complexType>
	    <element name="Model">
		<simpleType base="string">
		    <enumeration value = "Ford"/>
		    <enumeration value = "Saab"/>
		    <enumeration value = "Audi"/>
		</simpleType>
	    </element>
	    <element name="Make">
		<simpleType base="string">
		    <minLength value = "1"/>
		    <maxLength value = "30"/>
		</simpleType>
	    </element>
	    <element name="Year">
		<complexType content="mixed">
		    <attribute name="PreviouslyOwned" type="string"
			       use="required"/>
		    <attribute name="YearsOwned" type="integer"
			       use="optional"/>
		</complexType>
	    </element>
	    <element name="OwnerName" type="string"
		     minOccurs="0" maxOccurs="unbounded"/>
	    <element name="Condition">
		<complexType base="string" derivedBy="extension">
		    <attribute name="Automatic">
			<simpleType base="string">
			    <enumeration value = "Yes"/>
			    <enumeration value = "No"/>
			</simpleType>
		    </attribute>
		</complexType>
	    </element>
	    <element name="Mileage">
		<simpleType base="integer">
		    <minInclusive value="0"/>
		    <maxInclusive value="2000000"/>
		</simpleType>
	    </element>
	    <attribute name="RequestDate" type="date"/>
	</complexType>
    </element>
</schema>

XML Schema for C Example 3: car.xml

<?xml version="1.0"?>
<schema xmlns = "http://www.w3.org/1999/XMLSchema"
        targetNamespace = "http://www.CarDealers.com/">
    <element name="Car">
	<complexType>
	    <element name="Model">
		<simpleType base="string">
		    <enumeration value = "Ford"/>
		    <enumeration value = "Saab"/>
		    <enumeration value = "Audi"/>
		</simpleType>
	    </element>
	    <element name="Make">
		<simpleType base="string">
		    <minLength value = "1"/>
		    <maxLength value = "30"/>
		</simpleType>
	    </element>
	    <element name="Year">
		<complexType content="mixed">
		    <attribute name="PreviouslyOwned" type="string"
			       use="required"/>
		    <attribute name="YearsOwned" type="integer"
			       use="optional"/>
		</complexType>
	    </element>
	    <element name="OwnerName" type="string"
		     minOccurs="0" maxOccurs="unbounded"/>
	    <element name="Condition">
		<complexType base="string" derivedBy="extension">
		    <attribute name="Automatic">
			<simpleType base="string">
			    <enumeration value = "Yes"/>
			    <enumeration value = "No"/>
			</simpleType>
		    </attribute>
		</complexType>
	    </element>
	    <element name="Mileage">
		<simpleType base="integer">
		    <minInclusive value="0"/>
		    <maxInclusive value="2000000"/>
		</simpleType>
	    </element>
	    <attribute name="RequestDate" type="date"/>
	</complexType>
    </element>
</schema>

XML Schema for C Example 4: car.std

XML C Schema processor
Initializing XML package...
Parsing 'car.xml' ...
Initializing Schema package...
Validating document...
Document is valid.

XML Schema for C Example 5: aq.xsd

<?xml version="1.0"?>

<!-- ****************** AQ xml schema  ****************** -->

<schema xmlns = "http://www.w3.org/1999/XMLSchema"
        targetNamespace = "http://www.oracle.com/AQXmlDocument"
        xmlns:aq = "http://www.oracle.com/AQXmlDocument"
        xmlns:xsd = "http://www.w3.org/1999/XMLSchema"
	elementFormDefault="qualified">

   <element name="AQXmlDocument">
      <complexType content="mixed">
        <choice>
              <group ref="aq:client_operation" minOccurs="0"/>
              <group ref="aq:server_response"/>
        </choice>
      </complexType>
    </element>   


   <!-- ****************** Client Operations Group  ****************** -->
   <group name="client_operation">
       <sequence>
          <element ref="aq:client_operation" minOccurs="0" maxOccurs="1"/>
  	    <choice>
              <element ref="aq:producer_options" maxOccurs="1"/>
              <element ref="aq:consumer_options" maxOccurs="1"/>
              <element ref="aq:register_options" maxOccurs="1"/>
            </choice>
          <element ref="aq:message_set" minOccurs="0" maxOccurs="*"/>
       </sequence>
    </group>


   <!-- ****************** Server Response Group ****************** -->
   <group name="server_response">
       <sequence>
          <element ref="aq:server_response" minOccurs="0" maxOccurs="1"/>
          <element ref="aq:receive_result" maxOccurs="1"/>
          <choice  minOccurs="0" >
              <element ref="aq:send_result" maxOccurs="1"/>
              <element ref="aq:publish_result" maxOccurs="1"/>
              <element ref="aq:receive_result" maxOccurs="1"/>
              <element ref="aq:sequence_num_result" maxOccurs="1"/>
          </choice>
       </sequence>
   </group>


   <!-- ****************** Server Propagation Group ****************** -->
   <group name="server_prop_operation">
       <sequence>
          <element ref="aq:server_prop_operation" minOccurs="0" maxOccurs="1"/>
          <choice>
              <element ref="aq:push" maxOccurs="1"/>
              <element ref="aq:notification" maxOccurs="1"/>
              <element ref="aq:sequence_num_request" maxOccurs="1"/>
          </choice>
       </sequence>
   </group>


   <!-- ****************** Client Operation ****************** -->
   <element name="client_operation">
      <complexType content="mixed">
        <element ref="aq:txid" minOccurs="0"/>   	
	<attribute name="opcode" use="required" type="aq:opcode_type"/>
      </complexType>
   </element>   

   <!-- ****************** Server Response ****************** -->
   <element name="server_response">
      <complexType content="mixed">
        <element ref="aq:txid" minOccurs="0"/>   	
        <element ref="aq:status_response" minOccurs="1"/>   	
	<attribute name="opcode" use="required" type="aq:opcode_type"/>
      </complexType>
   </element>   

   <!-- ****************** Server Propagation Operation ****************** -->
   <element name="server_prop_operation">
      <complexType content="mixed">
        <element ref="aq:txid" minOccurs="0"/>   	
	<attribute name="prop_opcode" use="required" type="aq:prop_opcode_type"/>
      </complexType>
   </element>   


   <element name="txid" type="string"/>   		

   <element name="destination">
     <complexType base='string' derivedBy="extension">
     <attribute name="lookup_type" type="aq:dest_lookup_type" 
        	use="default" value="NORMAL"/>
     </complexType>
   </element>   		

   <!-- **** destination lookup type ******* -->
   <!-- lookup_type can be specified to either lookup LDAP or use  -->
   <!-- the destination directly in NAME::ADDRESS::PROTOCOL format -->
   <simpleType name="dest_lookup_type" base="string">
      <enumeration value="NORMAL"/>
      <enumeration value="LDAP"/>
    </simpleType>

   <!-- ****************** Producer Options ****************** -->
   <element name="producer_options">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/>   	
        <element ref="aq:priority" minOccurs="0" maxOccurs="1"/>   	
        <element ref="aq:expiration" minOccurs="0" maxOccurs="1"/>   	
        <element ref="aq:recipient_list" minOccurs="0" maxOccurs="1"/>  
	<attribute name="visibility" type="aq:visibility_type" 
	           use="default" value="ON_COMMIT"/>
	<attribute name="delivery_mode" type="aq:del_mode_type" 
	           use="default" value="PERSISTENT"/>
      </complexType>
    </element>   

   <!-- ****************** Consumer Options ****************** -->
   <element name="consumer_options">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:consumer_name" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:wait_time" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:selector" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:batch_size" minOccurs="0" maxOccurs="1"/> 

	<attribute name="visibility" type="aq:visibility_type" 
	           use="default" value="ON_COMMIT"/>
	<attribute name="dequeue_mode" type="aq:deq_mode_type" 
	           use="default" value="REMOVE"/>
	<attribute name="navigation" type="aq:nav_mode_type" 
	           use="default" value="NEXT_MESSAGE"/>
       </complexType>
    </element>   


   <!-- ****************** Register Options ****************** -->
   <element name="register_options">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:consumer_name" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:notify_url" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:qos" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:batch_size" minOccurs="0" maxOccurs="1"/> 
      </complexType>
    </element>   

   <element name="recipient_list">
     <complexType content="mixed">
	<element ref="aq:recipient" minOccurs="1" maxOccurs="*"/>
     </complexType>
   </element>   


   <!-- ****************** Message Set ************************* -->
   <element name="message_set">
      <complexType content="mixed">
        <element ref="aq:message_count" minOccurs="1"/>   	
        <element ref="aq:message" minOccurs="0" maxOccurs="*"/>  
      </complexType>
   </element>   


   <!-- ****************** Message ************************* -->
   <element name="message">
      <complexType content="mixed">
        <element ref="aq:message_number" minOccurs="0"/>   	
        <element ref="aq:message_header" minOccurs="1" maxOccurs="1"/>  
        <element ref="aq:message_payload" minOccurs="0" maxOccurs="1"/>  
      </complexType>
   </element>   


   <!-- ****************** Message header ****************** -->
   <element name="message_header">
      <complexType content="mixed">
        <element ref="aq:message_id" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:correlation" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:delay" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:priority" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:delivery_count" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:message_state" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:sender_id" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:exception_queue" minOccurs="0" maxOccurs="1"/> 
      </complexType>
    </element>   


   <!-- ****************** Oracle JMS properties ****************** -->
   <element name="oracle_jms_properties">
      <complexType content="mixed">
        <element ref="aq:type" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:reply_to" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:userid" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:appid" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:groupid" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:group_sequence" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:timestamp" minOccurs="0" maxOccurs="1"/> 
        <element ref="aq:recv_timestamp" minOccurs="0" maxOccurs="1"/> 
      </complexType>
    </element>   


   <!-- ****************** Message payload ****************** -->
   <element name="message_payload">
     <complexType>
        <choice>
          <element ref="aq:jms_text_message" minOccurs="0" maxOccurs="1"/> 
          <element ref="aq:jms_map_message" minOccurs="0" maxOccurs="1"/> 
          <element ref="aq:jms_bytes_message" minOccurs="0" maxOccurs="1"/> 
          <element ref="aq:jms_object_message" minOccurs="0" maxOccurs="1"/> 
   	  <any minOccurs="0" maxOccurs="*" processContents="skip"/>
        </choice>
     </complexType>
   </element>   		

...

   <!-- ****************** Status response ****************** -->
   <element name="status_response">
      <complexType content="mixed">
        <element ref="aq:acknowledge" minOccurs="0" maxOccurs="1"/>   	
        <element ref="aq:status_code" minOccurs="0" maxOccurs="1"/>   	
        <element ref="aq:error_code" minOccurs="0" maxOccurs="1"/>   	
        <element ref="aq:error_message" minOccurs="0" maxOccurs="1"/>  
      </complexType>
   </element>   

   <!-- ****************** Send result ****************** -->
   <element name="send_result">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/>   	
        <element ref="aq:message_id" minOccurs="0" maxOccurs="*"/>   	
      </complexType>
   </element>   

   <!-- ****************** Publish result ****************** -->
   <element name="publish_result">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/>   	
        <element ref="aq:message_id" minOccurs="0" maxOccurs="*"/>   	
      </complexType>
   </element>   

   <!-- ****************** Receive result ****************** -->
   <element name="receive_result">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/>   	
        <element ref="aq:message_set" minOccurs="0" maxOccurs="*"/>   	
      </complexType>
   </element>   

....
   <!-- ****************** Push messages *************************** -->
   <element name="push">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/>   	
        <element ref="aq:consumer_name" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:sequence_number" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:message_set" minOccurs="1" maxOccurs="1"/> 
      </complexType>
   </element>   

   <!-- ****************** Notification *************************** -->
   <element name="notification">
      <complexType content="mixed">
        <element ref="aq:destination" minOccurs="1" maxOccurs="1"/>   	
        <element ref="aq:consumer_name" minOccurs="1" maxOccurs="1"/> 
        <element ref="aq:message" minOccurs="0" maxOccurs="1"/> 
      </complexType>
   </element>   

   <element name="priority" type="integer"/>   		
   <element name="expiration" type="integer"/>   		
   <element name="consumer_name" type="string"/> 
   <element name="wait_time" type="integer"/>  
   <element name="batch_size" type="integer"/>  
   <element name="qos" type="string"/> 
   <element name="notify_url" type="string"/> 
   <element name="message_id" type="string"/> 
   <element name="message_state" type="string"/>

   <element name="sequence_number" type="integer"/>  
   <element name="message_number" type="integer"/>  
   <element name="message_count" type="integer"/>  

   <element name="correlation" type="string"/> 
   <element name="delay" type="integer"/> 
   <element name="delivery_count" type="integer"/> 
   <element name="exception_queue" type="string"/> 


   <element name="type" type="string"/> 
   <element name="userid" type="string"/> 
   <element name="appid" type="string"/> 
   <element name="groupid" type="string"/> 
   <element name="group_sequence" type="integer"/> 
   <element name="timestamp" type="date"/> 
   <element name="recv_timestamp" type="date"/> 


   <element name="recipient">
     <complexType base='string' derivedBy="extension">
     <attribute name="lookup_type" type="aq:dest_lookup_type" 
	           use="default" value="NORMAL"/>
     </complexType>
   </element>   		

   <element name="sender_id">
     <complexType base='string' derivedBy="extension">
     <attribute name="lookup_type" type="aq:dest_lookup_type" 
	           use="default" value="NORMAL"/>
     </complexType>
   </element>   		

   <element name="reply_to">
     <complexType base='string' derivedBy="extension">
     <attribute name="lookup_type" type="aq:dest_lookup_type" 
	           use="default" value="NORMAL"/>
     </complexType>
   </element>   		

   <element name="selector"> 
     <complexType>
	<choice>
          <element ref="aq:correlation_id" minOccurs="0" maxOccurs="1"/> 
          <element ref="aq:message_id" minOccurs="0" maxOccurs="1"/> 
          <element ref="aq:complex_selector" minOccurs="0" maxOccurs="1"/> 
        </choice>
     </complexType>
   </element>

   <element name="correlation_id" type="string"/>  
   <element name="complex_selector" type="string"/>  

    <simpleType name="visibility_type" base="string">
      <enumeration value="ON_COMMIT"/>
      <enumeration value="IMMEDIATE"/>
    </simpleType>

   <simpleType name="del_mode_type" base="string">
      <enumeration value="PERSISTENT"/>
      <enumeration value="NONPERSISTENT"/>
    </simpleType>

   <simpleType name="deq_mode_type" base="string">
      <enumeration value="BROWSE"/>
      <enumeration value="LOCKED"/>
      <enumeration value="REMOVE"/>
      <enumeration value="REMOVE_NO_DATA"/>
    </simpleType>

   <simpleType name="nav_mode_type" base="string">
      <enumeration value="FIRST_MESSAGE"/>
      <enumeration value="NEXT_MESSAGE"/>
      <enumeration value="NEXT_TRANSACTION"/>
    </simpleType>

   <simpleType name="opcode_type" base="string">
      <enumeration value="SEND"/>
      <enumeration value="RECEIVE"/>
      <enumeration value="PUBLISH"/>
      <enumeration value="REGISTER"/>
      <enumeration value="COMMIT"/>
      <enumeration value="ROLLBACK"/>
      <enumeration value="SEQ_NUM_REQUEST"/>
   </simpleType>

   <simpleType name="prop_opcode_type" base="string">
      <enumeration value="SEND"/>
      <enumeration value="NOTIFICATION"/>
      <enumeration value="COMMIT"/>
      <enumeration value="ROLLBACK"/>
      <enumeration value="SEQ_NUM_REQUEST"/>
   </simpleType>

   <element name="acknowledge">
     <complexType content="empty">
     </complexType>
   </element>   		
   <element name="status_code" type="string"/> 
   <element name="error_code" type="string"/> 
   <element name="error_message" type="string"/> 

    <simpleType name="prop_type" base="string">
      <enumeration value="STRING"/>
      <enumeration value="NUMBER"/>
    </simpleType>

   <element name="name" type="string"/> 
   <element name="value" type="string"/> 

   <!-- ****************** JMS text message ****************** -->
   <element name="jms_text_message">
      <complexType content="mixed">
        <element ref="aq:oracle_jms_properties" minOccurs="0" maxOccurs="1"/>  
        <element ref="aq:user_properties" minOccurs="0" maxOccurs="1"/>  
        <element ref="aq:text_data" minOccurs="1" maxOccurs="1"/>  
      </complexType>
   </element>   
   <element name="text_data" type="string"/> 

....

   <!-- ****************** JMS object message ****************** -->
   <element name="jms_object_message">
      <complexType content="mixed">
        <element ref="aq:oracle_jms_properties" minOccurs="0" maxOccurs="1"/>  
        <element ref="aq:user_properties" minOccurs="0" maxOccurs="1"/>  
        <element ref="aq:ser_object_data" minOccurs="1" maxOccurs="1"/>  
      </complexType>
   </element>   
	
   <element name="ser_object_data" type="string"/> 
</schema>

XML Schema for C Example 6: aq.xml

<AQXmlDocument xmlns="http://www.oracle.com/AQXmlDocument"
	       xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
	       xsi:schemaLocation="http://www.oracle.com/AQXmlDocument aq.xsd">

    <client_operation opcode="SEND">
        <txid> sdasdfdsf </txid>
    </client_operation>

    <producer_options delivery_mode="PERSISTENT">
        <destination lookup_type="NORMAL"> queue1 </destination>
        <priority>23</priority>
        <recipient_list>
            <recipient> abc </recipient>
            <recipient lookup_type="LDAP"> abc </recipient>
        </recipient_list>
    </producer_options>

    <message_set>
        <message_count>1</message_count>
        <message>
            <message_number>1</message_number>
            <message_header>
                <correlation>XML_40_NEW_TEST</correlation>
                <delay>10</delay>
                <sender_id>scott::home::0</sender_id>
            </message_header>
            <message_payload>
                <jms_map_message>
                    <oracle_jms_properties>
                        <reply_to>oracle::redwoodshores::100</reply_to>
                        <userid>scott</userid>
                        <appid>AQProduct</appid>
                        <groupid>AQ</groupid>
                    </oracle_jms_properties>
                    <user_properties>
                        <property property_type="STRING">
                            <name>country</name>
                            <value>USA</value>
                        </property>
                        <property property_type="STRING">
                            <name>State</name>
                            <value>california</value>
                        </property>
                    </user_properties>
                    <map_data>
                        <item item_type="STRING">
                            <name>Car</name>
                            <value>Toyota</value>
                        </item>
                        <item item_type="STRING">
                            <name>Color</name>
                            <value>Blue</value>
                        </item>
                        <item item_type="STRING">
                            <name>Shape</name>
                            <value>Circle</value>
                        </item>
                        <item item_type="NUMBER">
                            <name>Price</name>
                            <value>20000</value>
                        </item>
                    </map_data>
                </jms_map_message>
            </message_payload>
        </message>
    </message_set>
</AQXmlDocument>

XML Schema for C Example 7: aq.std

XML C Schema processor
Initializing XML package...
Parsing 'aq.xml' ...
Initializing Schema package...
Validating document...
Document is valid.

XML Schema for C Example 8: pub.xsd

<?xml version="1.0"?>
<schema xmlns = "http://www.w3.org/2000/08/XMLSchema"
        targetNamespace = "http://www.somewhere.org/BookCatalogue"
        xmlns:cat = "http://www.somewhere.org/BookCatalogue"
        elementFormDefault="qualified">

    <complexType name="Pub">
      <sequence>
        <element name="Title" type="cat:titleType" maxOccurs="*"/>
        <element name="Author" type="string" maxOccurs="*"/>
        <element name="Date" type="date"/>
      </sequence>
      <attribute name="language" type="string" use="default" value="English"/>
      <anyAttribute namespace="##local"/>
    </complexType>

    <element name="Publication" type="cat:Pub"  abstract="true"/>
    <element name="Book" substitutionGroup="cat:Publication">
        <complexType>
           <complexContent>
               <extension base="cat:Pub" >
                  <sequence>
                     <element name="ISBN" type="string" default="123456789"/>
                     <element name="Publisher" type="string"/>
                  </sequence>
               </extension>
           </complexContent> 
      </complexType>
    </element>
    <complexType name="titleType">
       <simpleContent>
          <extension base="string" >
             <attribute name="old" type="string" use="default" value="false"/>
          </extension>
       </simpleContent>
    </complexType>
    <element name="Magazine" substitutionGroup="cat:Publication">
        <complexType>
           <complexContent>
              <extension base="cat:Pub">
                  <sequence>
                     <element name="Volume" type="cat:VolumeType"/>
                     <element name="htmlTable">
                        <complexType>
                           <any namespace="##other"
                               processContents="skip"
                               minOccurs="0" maxOccurs="2"/>
                        </complexType>
                      </element>
                  </sequence>
              </extension>
           </complexContent>
        </complexType>
    </element>
    <simpleType name="VolumeType">
       <restriction base="integer" >
          <minInclusive value = "1"/>
          <maxInclusive value = "12"/>
       </restriction>
    </simpleType>
    <element name="Catalogue">
        <complexType>
           <sequence>
             <element ref="cat:Publication" minOccurs="0" maxOccurs="*"/>
           </sequence>   
        </complexType>
    </element>
</schema>

XML Schema for C Example 9: pub.xml

<?xml version="1.0"?>
<?xml version="1.0"?>

<Catalogue xmlns = "http://www.somewhere.org/BookCatalogue"
	   xmlns:cat = "http://www.somewhere.org/BookCatalogue"
	   xmlns:html = "http://www.somewhere.org/HTMLCatalogue"
	   xmlns:xsi = "http://www.w3.org/1999/XMLSchema-instance"
	   xsi:schemaLocation =
                      "http://www.somewhere.org/BookCatalogue pub.xsd">

        <cat:Magazine>
                <Title>Natural Health</Title>
                <Author>October</Author>
                <Date>1999-12</Date>
                <Volume>12</Volume>
                <htmlTable>
                   <table  xmlns = "http://www.somewhere.org/HTMLCatalogue">
                      <tr>....</tr>
                   </table>
                   <html:table>
                      <html:tr>....</html:tr>
                   </html:table>
                </htmlTable>
        </cat:Magazine>

        <Book>
                <Title>Illusions The Adventures of a Reluctant Messiah</Title>
                <Author>Richard Bach</Author>
                <Date>1977</Date>
                <ISBN></ISBN>
                <Publisher>Dell Publishing Co.</Publisher>
        </Book>

        <Book>
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Date>1954</Date>
                <ISBN>0-06-064831-7</ISBN>
                <Publisher>Harper &amp; Row</Publisher>
        </Book>

</Catalogue>

XML Schema for C Example 10: pub.std

XML C Schema processor
Initializing XML package...
Parsing 'pub.xml' ...
Initializing Schema package...
Validating document...
Document is valid.


Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index