A basic introduction to schemas
What is a schema?
A schema is a definition structure to describe how a data source is built up, so that it can be processed for input and/or output. The Jsapar library needs to know how to interpret the data source(s) it must process in order to be successful. Without such definition structure, the library is clueless in how to deal with these data sources. Therefore, a schema is always needed by the library.
How is a schema built up?
A schema consists of one specific schema class and one or more schemaline classes based on the type of data source that must be processed.
How to specify a schema?
A schema is always used in code, so at least one schema object is necessary to be constructed for using the JsaPar library. The schema class can be constructed by loading a XML document into the schema class or can be constructed programmatically by using Java code only. For simple data source structures the schema is easily constructed using Java code. For complex data source structures it is preferable to specify these schemas using a XML document. A schema is always adjustable, even if the schema structure is loaded before using a XML document.
What type of schemas are there?
For types of schemas are defined for use in conjuction with the JsaPar library. These are:
- Comma Separated Value
- Comma Separated Value control value
- Fixed width
- Fixed width control value
All schemas classes are derived from the default schema class: org.jsapar.schema.Schema.
TODO: All possible schema options for XML are discussed in this article.
Schema exception handling is discussed in the handling errors article.
Writing an XML specification file
Writing a Fixed Width xml file
Writing a Fixed Width control value xml file
Writing a Comma Separated Value xml file
Writing a Comma Separated Value control value xml file
Using xml as input for a Document