Maclochlainn's Weblog

Michael McLaughlin's Old Technical Blog

Convert XML Files to Comma-delimited Files without Programming

with one comment

A couple students snagged some data through Google searches but they found it was formatted as an XML file. They wanted to know the easiest way to convert it and load it into an Oracle database. I created this quick reference which leverages Apache Xalan Project command-line tool and Oracle external tables. You must source files in the %CLASSPATH% (or $CLASSPATH) correctly order as shown in the example or you will raise a “NoClassDefFoundError: org/apache/xalan/xslt/Process” error.

Briefly, XML supports two paradigms. One is the single-pass compiler (or streams approach). Another is a data structure (or tree approach), which typically requires programming skills.

XSLT Processors typically implement a streams approach. You call the XSLT Processor by passing two arguments. One is an XML source document and the other XSL style sheet.

While this is often done in your web browser or an application, you can leverage the technology to manually convert an XML file transfer into a comma-delimited file. Comma-delimited files are also known as comma separated value (CSV) files. After you convert the XML file you can use an Oracle external table to read it into the database. Naturally, the Oracle XDK offers more features and complexity.

A quick example …


Written by maclochlainn

June 22, 2008 at 11:07 pm

One Response

Subscribe to comments with RSS.

  1. They can try

    Simple and to the point.

    I love using


    June 30, 2008 at 3:55 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: