Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > XML Validation From Flat File?

Reply
Thread Tools

XML Validation From Flat File?

 
 
Homer
Guest
Posts: n/a
 
      05-29-2006
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?


Thanks in Advance,

Homer

 
Reply With Quote
 
 
 
 
Oliver Wong
Guest
Posts: n/a
 
      05-29-2006

"Homer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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

 
Reply With Quote
 
 
 
 
Homer
Guest
Posts: n/a
 
      05-29-2006
Thanks Oliver for your reply. I did some readings and found one way
(though I am not sure it's easies one). I convert one sample file to
XML (I am using Stylus Studio to do that). Then I run Trang to generate
XSD file from my XML file. From now I can use that XSD to validate all
my files with the same format.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add validation rule for url in the validation-rule.xml ,I added some thing like this but......... shailajabtech@gmail.com Java 0 10-12-2006 08:36 AM
XML Not good for Big Files (vs Flat Files) Homer Java 230 05-01-2006 07:46 PM
Struts Validation Framework: suppressing startup output from validation.xml javadude Java 0 02-16-2005 05:37 PM
XML schema validation of one xml block based on values from another xml block Andy XML 0 11-18-2004 11:04 PM
Complex validation of business rules possible with XML Schema? Any other validation "languages"? Mike XML 1 11-21-2003 07:27 PM



Advertisments