Loading Datagrams with the XML SQL Utility
The Oracle XML SQL Utility is a
command-line utility and a set of Java classes used to automate
getting XML out of your database and putting XML into your database.
We have seen that the OracleXMLQuery
class handles
all the details of getting SQL query results out of the database in a
canonical XML format. The XML SQL Utility also contains a companion
class called
OracleXMLSave
that performs the opposite job of putting
XML information back into Oracle tables or views.
The OracleXMLSave
class understands how to insert
any information that OracleXMLQuery
knows how to
produce. In other words, the canonical structure of the
output from OracleXMLQuery
defines the kinds of structures for input that
OracleXMLSave
can automatically insert for us.
Transforming Datagrams for Insertion
The fact that
OracleXMLSave
can only insert XML documents that
look like they were produced by OracleXMLQuery
may
at first sound like a drastic limitation. However, this is not the
case by any stretch of the imagination. By taking advantage of an
appropriate XSLT transformation, virtually any XML document can be
transformed to the canonical format required by
OracleXMLSave
. Given an arbitrary XML document
YourDoc
and a database table or view into which
you want to insert the document, you can create an XSLT
transformation that transforms the source
document YourDoc
into a
target document
YourDocCanonical
having precisely the structure needed for automatic insertion ...
Get Building Oracle XML Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.