Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Introduction to Oracle XML, 23 of 27

## Sending XML Data from a Web Form to a Database

One way to ensure that data obtained via a web form will map to an underlying database schema is to design the web form and its underlying structure so that it generates XML data based on a schema-compatible DTD. This section describes how to use the XML SQL Utility and the XML Parser for Java to achieve this. This scenario has the following flow:

1. A Java application uses the XML SQL Utility to generate a DTD that matches the expected format of the target object view or table.

2. The application feeds this DTD into the XML Class Generator for Java, which builds classes that can be used to set up the web form presented to the user.

3. Using the generated classes, the web form is built dynamically by a JavaServer Page, Java servlet, or other component.

4. When a user fills out the form and submits it, the servlet maps the data to the proper XML data structure and the XML SQL Utility writes the data to the database.

You can use the DTD-generation capability of the XML SQL Utility to determine what XML format is expected by a target object view or table. To do this, you can perform a SELECT * FROM an object view or table to generate an XML result.

This result contains the DTD information as a separate file or embedded within the DOCTYPE tag at the top of the XML file.

Use this DTD as input to the XML Class Generator to generate a set of classes based on the DTD elements. You can then write Java code that use these classes to generate the infrastructure behind a web-based form. The result is that data submitted via the web form will be converted to an XML document that can be written to the database.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index