Here are some thoughts to help you with that tough part:
Generically:
• We need to ensure the parsed data is of the right data type. Best we add an API function to entity metadata that does that, e.g. entity_metadata_enforce_data_type(). I can take care of creating that function.
• I think you can restrict the number of available/parseable data types to the ones that make sense by hand.
CSV:
• Just allow the specification of column headers in actions
• Use that info to provide metadata that can be used with selectors ala [csv:4:rowName]
• We need to use a list notation for csv types such that the list-wrapper is correctly created. You can just specify the 'property info' for a line for the provided variable which has that type 'list'. For the type csv_line, you can specify struct as parent and enable wrapping.
XML:
• Elements might be nested. First off just cover nesting of simple types. We can care about nested complex type later on.
• For now just let the user specify the elements/attribtues of the root element similarily to the CSV case.
• For the nesting of complex types, we need defined types in place. Once we have that, we can allow the user to choose a defined type also, but also directly for the root element a complex type should be usable. Thus we need to provide two configuration ways then (existing data types, specify info).
• Elements can have attributes + children. I'd suggest to use the @attribute notation ala xpath to distinguish that in the selectors. If something has troubles with the @ we can patch that.
• Elements may occur once or multiple times. If multiple, just use list.
Comments
Comment #1
fagoad checking data type: I implemented that API function, see: http://drupal.org/cvs?commit=395998 & entity_metadata_verify_data_type().
Comment #2
sepgil commentedI've implemented all the required stuff.
Comment #3
sepgil commented