Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

XML Validation From Flat File?

Thread view: 
Homer - 29 May 2006 15:14 GMT
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
Oliver Wong - 29 May 2006 17:05 GMT
> Hi All,
>
[quoted text clipped - 4 lines]
> 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
Homer - 29 May 2006 19:07 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.