Parsing Filemaker 6 XML into something I can use

Hi

One of our customers has a Filemaker database which needs to be
accessed for some data. Using the Web Companion, I can query the
database for an XML version of the data. I need to be able to push
this data into an array of hashes, so I can access it in a more
convenient way. Filemaker is able to provide me with 2 XML formats
(DSO-XML and FMP-XML):


DSO-XML


<?xml version="1.0" encoding="UTF-8"?>www.filemaker.com/fmpdsoresu
lt">0Customers.fp5</
DATABASE>XMLDumpAcme</
Company>Somewherestreet 145
8200SomecityAcme the second</
Company>Somewherestreet 146
8500Somecity Elsewhere</
City>

FMP-XML


<?xml version="1.0" encoding="UTF-8"?>www.filemaker.com/fmpxmlresult">0<PRODUCT
BUILD=“9/10/2003” NAME=“FileMaker Pro Web Companion” VERSION=“6.0v2”/

<DATABASE DATEFORMAT=“d-M-yyyy” LAYOUT=“XMLDump”
NAME=“Customers.fp5” RECORDS=“26” TIMEFORMAT=“k:mm:ss”/
Acme</
COL>Somewherestreet 1458200</
DATA>SomecityAcme the second</
COL>Somewherestreet 1468500</
DATA>Somecity Elsewhere</
RESULTSET>

What would be the best way to get this into something I can use in my
controller? I’ve been playing around with REXML, but I’m hitting
walls here.

Thanks in advance!

Best regards

Peter De Berdt

What “walls” are you hitting? As long as Filemaker is giving you valid
xml, I would just
parse it with REXML and then grab what you need with XPaths.

http://www.germane-software.com/software/rexml/docs/tutorial.html

b

On 25 Mar 2006, at 08:10, Ben M. wrote:

What “walls” are you hitting? As long as Filemaker is giving you
valid xml, I would just parse it with REXML and then grab what you
need with XPaths.

http://www.germane-software.com/software/rexml/docs/tutorial.html

That’s exactly the kind of tutorial I was looking for. Thanks!

Best regards

Peter De Berdt

The Filemaker XML is something I find hard to use so I’ll be trying to
export to Excel, then to CSV, then parse the CSV with either Ruby’s
standard libraries or with fastercsv. If you export from Filemaker
directly to CSV, it doesn’t give you the column headings, hence my
exporting to Excel format first. There’s another gem called csv-mapper
which I have no experience with, but it’s supposed to convert CSV to
active record - exactly what I need.

On Mar 6, 1:30am, Michael N. [email protected] wrote:

The Filemaker XML is something I find hard to use so I’ll be trying to
export to Excel, then to CSV, then parse the CSV with either Ruby’s
standard libraries or with fastercsv. If you export from Filemaker
directly to CSV, it doesn’t give you the column headings, hence my
exporting to Excel format first. There’s another gem called csv-mapper
which I have no experience with, but it’s supposed to convert CSV to
active record - exactly what I need.


Posted viahttp://www.ruby-forum.com/.

It sounds like you may already have a solution but don’t want to RT*M.
That being said have you considered using something like Nokogiri
(http://nokogiri.org/) to parse the XML directly? I’ve had great
success parsing both HTML and XML using it, in fact it seems to be the
de facto parser used in the RoR community (someone correct me if I’m
wrong on this). But the point is, Nokogiri would probably save you a
couple steps and a lot of sanity if you intend to make going between
them (Filemaker and RoR) a regular thing.