Thread: XML data
View Single Post

  #2 (permalink)  
Old 04-07-2008
Jerry Stuckle
 
Posts: n/a
Default Re: XML data

Ted wrote:
> I have access to a data feed that provides data in XML documents, with
> a structure that matches the columns in a table. (I.e. it is a simple
> XMl format where the child elements correspond exactly to the columns
> in the target table). When using the feed's web interface, that
> interface provides the option to retrieve the same data as in excel
> spreadsheet or as a CSV file. Alas, the API provided does not seem to
> provide the option of obtaining the data in these formats.
>
> Is there a relatively painless option for processing the XML file to
> parse it and place the data it contains into the right records and
> columns? Yes, I saw the option for getting a dump of an existing
> database in XML format and subsequently reading that data into MySQL,
> but the difference here is that MySQL is not what is producing the XML
> file.
>
> Equally importantly, I can not store the data in MySQL for a number of
> reasons. There is a lot of data, the maximum length of the strings is
> unknown (i.e. if it would be stored as a string, varchar would be the
> obvious option, but what length?). And reports must be generated and
> it would be silly to process the strings anew every time a new report
> is required. It is best to process the XML just once and store the
> data in the fields in the appropriate record/column.
>
> Is there something built into MySQL that would make what I need to do
> relatively painless, or an external tool?
>
> I have managed to avoid parsing XML up till now (parsing strings is
> one of the programming tasks I dislike the most), but alas it has
> caught up to me and I have to bear down on it and put together
> something which will make processing XML less painful when I have to
> do it. :-(
>
> Thanks,
>
> Ted
>


Ted,

I doubt there's much you can do with MySQL itself unless it matches the
XML produced by MySQL. You'll probably have to use another language
such as Perl or PHP - both of which have ways of working with XML files.

And I don't know why you can't store the data in the database. It would
be much more efficient than working with the xml data. Things like
column lengths are up to you - they just need to be big enough to hold
the largest string you will store in them.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote