Home | Business News | Browse by Publication | X | XML Journal

Using XSLT to generate SQL: a simple, adaptable example to get you started. (XSLT).

Publication: XML Journal
Publication Date: 01-AUG-03
Format: Online - approximately 2127 words
Delivery: Immediate Online Access

Article Excerpt
Examples of selecting data from a database to produce XML are not too difficult to find. A Google search or a visit to the XML section at your local bookstore will no doubt reveal several such examples. It can, however, be more difficult to locate examples of how to insert data from XML into a database. Even if you locate such examples, it can be a challenge (to say the least) to adapt them to large XML files in which the data you need resides in a selected number of elements nested several levels deep within the file.

This article illustrates how to use XSLT to generate SQL, which can then be loaded into an Oracle database using Unix shell scripts. For the purpose of illustrating the concept, the example given is relatively short and straightforward, but the method used' in this article could easily be adapted to more complex projects. Furthermore, although this article focuses on getting data into an Oracle database from XML in a Unix environment, the concepts could be adapted to work with other database software running on other platforms.

There are at least two known methods for taking data from XML files and inserting it into Oracle. One method is to use the Java XSU insert method with an XML file. With this method, the structure of the XML file mirrors the structure of the Oracle table. Another method is to use Oracle's XML data type, which is available in Oracle9i. Using this method, a developer can insert the XML file directly into Oracle "as is." Both methods have their advantages in working with smaller XML files in which the elements are not heavily nested. However, in working with files in which the elements are heavily nested, both methods require the generation of a secondary XML file for database loading. This is a requirement if you wish to select only certain elements from...

View this article FREE - Now for a Limited Time, try Goliath Business News
Free for 3 Days!



More articles from XML Journal
3rd annual web services edge conference & expo: delivering .NET, Java,..., August 01, 2003
Multipass validation with XSD and Schematron part 2: using Schematron ..., August 01, 2003
JavaOne 2003: focus on XML and Web services. (Show Report)., August 01, 2003

Looking for additional articles?
Search our database of over 3 million articles.

Looking for more in-depth information on this industry?
Search our complete database of Industry & Market reports by text, subject, publication name or publication date.

About Goliath
Whether you're looking for sales prospects, competitive information, company analysis or best practices in managing your organization, Goliath can help you meet your business needs.

Our extensive business information databases empower business professionals with both the breadth and depth of credible, authoritative information they need to support their business goals. Whether it be strategic planning, sales prospecting, company research or defining management best practices - Goliath is your leading source for accurate information.