Oracle9i XML Customer Management Application(CMA)

Table of Contents

Overview of the Sample

Back To Top

This document describes Customer Management Application(CMA) using Oracle9i XML features. This application is a concise demonstration of  new XML features incorporated in Oracle9i. This application stores customer information as XML documents. Every customer record has a unique customer id. Each customer record stores customer name and customer information in XML with column called customer_xml. The column for storing customer XML is an XMLType column in the database. Customer can have an associated schema definition as well, however this is optional. This application allows users to view, update, modify, validate and delete the customer records.

Note: Further in this document, we refer to this application as CMA.

Oracle9i XML Features being demonstrated

Back To Top
  • Oracle XDK for java

    Oracle provides a set of XML parsers for Java and PL/SQL. Each of these parsers is a stand-alone XML component that parses an XML document (XML Schema) so that it can be processed by an application.

  • XMLType data type

    Oracle9i supports XMLType, a new system defined object type. XMLType has built-in member functions that offer a powerful mechanism to create, extract and index XML data. Users can also generate XML documents as XMLType instances dynamically using the SQL functions.

  • LAX mode validation of XML documents

    This sample also demonstrates Schema LAX validation of XML document provided. With LAX Mode Validation of XML Content, you can validate only some parts of the XML content without validating the whole document. The Schema can be defined for the part of XML which has to be validated and the flag SCHEMA_LAX_VALIDATION to be set in the Schema Processor to enable the LAX mode validation.

    For more information about Oracle XML features please visit /tech/xml/index.html

Server-side XML Schema validation through PL/SQL

Back To Top

We have written a PL/SQL package called as CUSTOMER. This package has two methods which validate the XML Schema and document. IsValidDocSchema and  IsValidDocSchemaURL methods in this package act as java stored procedures. These methods delegate their work to SchemaUtil class, which is deployed in the database.

XML Schema Validation through Java

Back To Top

When we upload any XML document using this application, we must specify a valid schema as well. This schema is used to validate the given XML document. If the document confirms to the given schema then it is insterted into the database along with corresponding schema document. We support two validation modes, Schema Validation and Schema LAX validation.

Running the Sample Application

Back To Top
  1. Please go through the Install.html and make sure that you set up the application properly.
  2. Visit the application home page Welcome.jsp and move your mouse over the menu to get  pop-up menu.
  3. Select 'Add new customer Information menu'.
  4. This will give you one more choice select 'New record using File Upload'.
  5. In the resultant screen, type Customer Name.
    Note: All .xml and .xsd example files referred below can be found under the CustomerManagement\xml directory which was extracted as part of installation instructions in the Install.html file.
  6. Select customer1.xml and click open
  7. Similarly select customer.xsd and click open.
  8. Select the Schema Validation radio button.
  9. Click on save button.
  10. This saves the data in the database.
  11. Similarly upload customer2 and customer3.xml with customer.xsd.
  12. Upload customerlax.xml with the customerlax.xsd schema and select the Schema LAX Validation radio button. This example demonstrates use of LAX validation.
  13. We can add customer documents by 2 more ways. We can cut and paste XML document and schema in the text area provided. If you want to use this method please select the 'New record using Form' menu option from the Welcome page.
  14. We can also provide url of XML document and XML schema document and use the third way of uploading documents. To do this select 'New record using URLs' menu from the Welcome page. If your document is on some other server where we have not granted connection privilege to the user an exception will be generated. This can be corrected by granting permission to the USER to open socket to that machine. Please refer installation instructions for more details. For example URL, refer to the ones provided on the 'New record using URLs' page.
  15. Select 'Edit existing customer information'. This will bring up a selection box where you can select the record you want to edit and press the 'Edit Record' button.
  16. You can View/Modify this document now and update the changes. You can press View Schema button to view the schema document associated with this XML document.
  17. Similar functionality is offered by menu 'View List of existing customers'. However we have an option of deleting the customer record here in addition.
  18. Select 'Query Customer Information'. This will bring up a page where we can enter query criteria.
  19. Search attribute name is mandatory here. Search attribute value is optional. If we specify both records are returned only if search attribute contains specified value inside it. If second parameter is not supplied all records having that attribute in the XML document are returned. This demonstrates use of Xpath and use of  XMLType variable in both PL/SQL and java.

Description of Sample Files

Back To Top

Directory File Name Description
CustomerManagement\jsps AddCustomer1.jsp This file accepts customer data in Text fields and allows users to store the data in database.

AddCustomer2.jsp

This file accepts customer data in file upload fields and allows users to store the data in database.

AddCustomer3.jsp

 

This file accepts customer data as URL’s and allows users to store the data in database.

DoDelete.jsp

 

This JSP does the work of deleting customer record

EditChoice.jsp This page allows users to select a particular customer from a drop down menu.
List.jsp This page displays list of all users. User can select a customer and view details by clicking button provided below.
Query.jsp This page allows users to enter Query parameters. Users can specify the attribute name and attribute value for searching.

QuerySubmit.jsp

This page returns the result of the submitted query.

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy