How can I import easily data from an XML file....
Posted in 2006
Topics: General Discussion
into Informix Database? Thanks in advance!!!!
You have to convert the file to a delimited format that can be loaded using the
dbaccess LOAD verb, the dbload utility, or Jonathan Leffler's sqlcmd utility
loader (sqlreload or sqlcmd -R or the LOAD verb). Dbload nad sqlreload can also
load fixed field data files. The only other alternative is to write or hack a
load utility to parse the input and load up the data directly. You could start
with the code to my ul.ec which unloads or loads a binary data file by
replacing
the input (which is a simple read) with an XML parser to load up the data
buffer. [ul.ec is contained in the package utils2_ak in the IIUG Software
Repository.]
Art S. Kagel
----- Original Message -----
From: Marti Camarasa <ids@iiug.org>
At: 7/27 2:40:54
into Informix Database?
Thanks in advance!!!!
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
On 7/27/06, MARTI CAMARASA <j.marti@dimension-informatica.es> wrote: > > [How can I import easily data from an XML file] into Informix Database? > If I was doing it, I'd take a look at the specification of the XML, and see which fields, if any, are optional - they're going to be a pain to deal with. Then I'd grab an XML shredding library, probably from Perl, and use it to read the XML input data, converting each record ito a delimited format record suitable for any standard Informix loading utility, and then I'd use any standard Informix loading utility. SQLCMD does have an XML generating mode, but it does not accept XML input data. There are many reasons for this, one of which is that there is no guarantee, in general, that the data in one XML record has the same fields in the same order as another record. Obviously, for a single load, there tends to be a certain family resemblance between the records, but that's about all that's guaranteed, absent a clear statement from the DTD or schema or equivalent. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/