Hi,
I did have a serious look last night at csv and xml, and I have a parser working. I am going for the following approach:
parse csv to xml then use xml xpath to query it and store in arrayMaker or in strings. the benefit from parsing csv to xml is xpath obviously where accessing data is just fun an easy. AND you can organise your csv data into more defined structure. currently I can allow you to define a column as being an attribute ( by defining the column name for the first field with a starting ampersand : "@customerID"
the following csv:
GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager
HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative
LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager
LETSS,Let's Stop N Shop,Jaime Yorres,Owner
I can output currently in
<?xml version="1.0"?>
<Customers>
<Customer CustomerID="GREAL">
<CompanyName>Great Lakes Food Market</CompanyName>
<ContactName>Howard Snyder</ContactName>
<ContactTitle>Marketing Manager</ContactTitle>
</Customer>
<Customer CustomerID="HUNGC">
<CompanyName>Hungry Coyote Import Store</CompanyName>
<ContactName>Yoshi Latimer</ContactName>
<ContactTitle>Sales Representative</ContactTitle>
</Customer>
<Customer CustomerID="LAZYK">
<CompanyName>Lazy K Kountry Store</CompanyName>
<ContactName>John Steel</ContactName>
<ContactTitle>Marketing Manager</ContactTitle>
</Customer>
<Customer CustomerID="LETSS">
<CompanyName>Let's Stop N Shop</CompanyName>
<ContactName>Jaime Yorres</ContactName>
<ContactTitle>Owner</ContactTitle>
</Customer>
</Customers>
then I can do for example xpath queries like "//Customer/ContactName" which will return *all* the contact names and I just inject that in an arrayListProxy and work with arrayMaker as usual from there. or simply selecting one node using "Customers/Customer[@CustomerID='GREAL']/ContactName" save it directly in a fsm string.
I working also on doing the following ( all fully author defined of course)
<Customer CustomerID="LETSS">
<CompanyName>Let's Stop N Shop</CompanyName>
<Contact>
<Name>Jaime Yorres</Name>
<Title>Owner</Title>
</Contact>
</Customer>
by defining a xml template for each row like so and inject the csv data following that xml template:
<Customer CustomerID="[0]">
<CompanyName>[1]</CompanyName>
<Contact>
<Name>[2]</Name>
<Title>[3]</Title>
</Contact>
</Customer>
It's not critical, but xpath querys will be nicer if your data is properly organized.
Bye,
Jean