Basic process flows include class generation, marshalling, unmarshalling, etc.5 Marshalling framework includes a set of ClassDescriptors and FieldDescription to describe objects.6
Class generation is similar to JAXB and Zeus. Castor supports XML Schema instead of DTDs (DTDs are not supported by Castor).789
Unmarshalling and marshalling are dealt with marshall() and unmarshall() methods respectively. During marshalling, conversion process from Java to XML is carried out, and, during unmarshalling, conversion process from XML to Java is carried out. Mapping files are the equivalent of a binding schema, which allows to transforms names from XML to Java and vice versa.10
Castor offers some additional features which are not present in JAXB. Additional features include:
Code for marshalling may look like as follows:
12
Code for unmarshalling may look like as follows:
13
Sample mapping file may look like as follows:
14
"About". Castor. Github. Retrieved 11 February 2016. https://castor-data-binding.github.io/castor/main/index.html ↩
McLaughin, B (2002). Java and XML Data Binding. Sebastopol: O'Reilly & Associates, Inc. pp. 143–165. ↩
XML Developer's Guide. Scotts Valley, USA: Borland Software Corporation. 2002. pp. (2–29)–(2–31). ↩
"The Source Code Generator". Castor. Github. Retrieved 11 February 2016. https://www2.informatik.hu-berlin.de/~xing/Lib/Docs/Castor/sourcegen.html ↩