Subject:CSV to XML: Ignore Missing Fields? Author:Homer Najafi Date:05 Jul 2006 11:49 AM
I am trying to convert a CVS file to XML using "Convert To XML" for creating Adaptor and then use Java to call that Adaptor.
I have these two questions:
1- My input file has either 32 or 36 fields in it (not even empty ',,'). How can I say ignore the missing 4 fields if there are not there and fill out the rest?
2- Some of the fields in my CVS file are suranded by Double-Quetes. Is there anyway to remove them during conversion? (e.g. John, “Smith”, 33 --> John, Smith, 33 --> XML)
>1- My input file has either 32 or 36 fields in it (not even
>empty ',,'). How can I say ignore the missing 4 fields if
>there are not there and fill out the rest?
I don't quite follow. If there is no field value present, the
default behavior is not to emit an empty element. Could you post
an example of the 32- and 36-field lines and point out what the
problem is?
The property in question is 'Omit from Output' and the default
value is 'When Empty' - which should be what you want.
>2- Some of the fields in my CVS file are suranded by
>Double-Quetes. Is there anyway to remove them during
>conversion? (e.g. John, “Smith”, 33 --> John, Smith, 33 --> XML)
Use 'Delimiter Pairs' and set the value to '"','"' (or the equivalent
34,34 if the previous is too hard to type in - 34 is the UNICODE value
for quote marks).
Thanks Tony. Actually you've answered my question.
I needed to set the "Omit from Output" to "Never" since I want those fields to be there regardless of being present, empty or not present