"Homer" <> wrote in message
news: ups.com...
> Hi All,
>
> I am trying to convert some Flat Files (Fixed-Width and CSV) to XML
> files (Using Java) and I was wondering what is the best way to validate
> the data in conversion time (in term and data type, size, missing
> fields, etc.)? I know javax.xml.validation helps but is this the
> easiest way? Is there any UI tool to help generating these Schema
> files?
If I understand your question correctly, wouldn't it make sense to
validate the data when you parse the flat file and are loading its semantic
representation into memory? As for how to validate it, that depends entire
on your data and what you consider valid. For example the technique to
validate a field which must a contain prime number is vastly different from
the technique to validate a field which must contain a date of birth of a
person who is still alive today, for example.
I don't think you can programmatically generate schema files which
specifying what is or isn't valid in some way. And it's probably unrealistic
to just write out your specifications for valid data in plain English and
have an AI read that description and generate XSDs for you. Your best bet is
probably to get a good XML editor which has support for writing XSDs and
write them out yourself.
- Oliver
|