Storing Posted XML Using XSQL Servlet

We’ve seen that the general steps for inserting XML into the database are as follows:

  1. Choose the table or view you want to use for inserting the XML information.

  2. Create an XSL transformation that transforms the inbound document into the canonical format for this table or view.

  3. Transform the inbound document into the canonical format for the table or view into which it will be inserted.

  4. Insert the transformed document into your table or view with the OracleXML utility.

The Oracle XML SQL Utility works well for inserting XML documents you have in front of you in operating system files. However, if you need to have other computers post live XML information to your web site for insertion into your database, you’ll need to use a slight twist on this approach.

Storing Posted XML Using XSQL Pages

The Oracle XSQL Servlet supports the <xsql:insert-request> action element, which you can include in any XSQL page to automate these steps:

  1. Read a posted XML document from the HTTP request.

  2. Transform it into the canonical format for insertion using any XSLT transformation you provide.

  3. Insert the transformed document into the table or view of your choice.

  4. Indicate the status of the operation by replacing the <xsql:insert-request> action element with an <xsql-status> element to show how many rows were inserted or to report an error.

Behind the scenes, the insert_request action handler makes programmatic use of the Oracle XSLT Processor to do the transformation and ...

Get Building Oracle XML Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.