Login | Register
My pages Projects Community openCollabNet

jsapar
Project home

On Friday, May 18, the normal maintenance window (17:00 Pacific time) will be extended for data center maintenance until 23:00 Pacific. No extended down-time is planned, but brief delays and interruptions are possible throughout the period.

If you were registered and logged in, you could join this project.

Summary Java lib for schema based parser/producer of CSV and flat files
Category libraries
License Apache License
Owner(s) stenix

JSaPar is a Java library providing a schema based parser/producer of CSV (Comma Separated Values) and flat files.

Mission

The goal of this project is to create a java library that contains a parser of flat files and csv files. The library should be simple to use and possible to extend.

Existing features

  • Support for flat files with fixed positions.
  • Support for CSV files.
  • The schema can be expressed with xml notation or created directly within the java code.
  • The parser can either produce a Document class, representing the content of the file, or you can choose to receive events for each line that has been successfully parsed.
  • Can handle huge files without loading everything into memory.
  • The output Document class contains a list of lines which contains a list of cells.
  • The Document class can be transformed into a Java object (via reflection) if the schema is carefully written.
  • It is also possible to produce java objects directly from the parser.
  • It is possible convert a list of java objects into a file according to a schema if the schema is carefully written.
  • The Document class can be built from a xml file (according to an internal xml schema).
  • The input and outputs are given by java.io.Reader and java.io.Writer which means that it is not necessarily files that are parsed or generated.
  • The file parsing schema contains information about how to parse each cell regarding data type and syntax.
  • Parsing errors can either be handled by exceptions thrown at first error or the errors can be collected during parsing to be able to deal with them later.
  • JUnit tests for most classes within the library.
  • Support for localisation.

Getting started

A quick introduction is available here.

Dependencies

This project has no dependencies to other external libraries in runtime.

However if you plan to build and test the source consider the following:

  • To build the source it is recommended to use Apache Ant. A build.xml script is provided.
  • If you use the Eclipse IDE, .classpath and .project files are provided in the source package.
  • The provided test classes require JUnit4 in order to run.
  • The binaries in the download package are built with java 1.6 but with target compatibility level 1.5. It is no guarantee that the library will work for earlier version of Java.

Other sources of information