Semi-ADV: XML into fP...far more easily -- NOW!

Fairlight fairlite at fairlite.com
Fri Dec 28 09:45:23 PST 2007


Hi All,

I've been working on something I've discussed with two developers in the fP
community.  Basically, XML is a royal pain to parse in fP, period.  We all
know this.

I wanted to translate XML to CSV format.  Indeed I did, just not the "one
line per complete 'record'" format that I wanted, mostly because it's -not-
possible to do with fP--there's no elegant way [no way at all, really] to
represent one-to-many relationships of dynamic size in a CSV "record".

What I do have is a program that simplifies your XML into 2-field lines
in CSV format.  You get all the information that's in the XML, plus hints
about where you are when containers open and close, etc.  In talking with
a couple developers about this, I was told that it's far preferable having
this easy-to-use format compared to trying to parse the raw XML, and that
an import of this type would be a -lot- easier to handle, as you just
handle it with far simpler processing as you read in the simplified CSV
formatted version, every line has two fields, etc.

If base64 data is embedded in a field, you can specify that it's decoded
to file and the filename is subbed into the data stream.  If you want to
exclude nodes or whole heirarchies, it will do that as well.

You can try the beta for yourself at:

     http://projects.fairlite.com/cgi-bin/demoxml2csv

Please note that the actual converter is a completely CLI program.  The
web front end I tacked on to demo it simply stores out the data from the
browser to files behind the scenes, calls xml2csv, and throws the resulting
file back into the bottom textarea.  The engine I'll be distrubuting (okay,
selling, admittedly) is a cross-platform CLI program though.

Feedback and inquiries welcome.

mark->


More information about the Filepro-list mailing list