[Simple-support] xjc created jaxb source from XML schema to simpleframework
Brought to you by:
niallg
|
From: Dennis B. <bij...@gm...> - 2011-09-11 13:09:27
|
Dear all,
I've written a SED script to convert java source files gerated with xjc
(from XML schema workig with JAXB) to simpleframework-compatible source code.
It depends a bit on the way xjc generates the software, so it may not
work directly on hand-written jaxb source code.
The script works as follows (tested on Ubuntu Linux):
- generate source with xjc: xjc XMLSchema.xsd
- jaxb2simple.sed generated/JAXBSource.java > src/generated/SimpleSource.java
- or in batch with the rewrite script:
NAMESPACE=generated
cd $NAMESPACE
for i in *.java ;do ../../rewrite.sh $i ../$NAMESPACE/ddi/$i ;done
The generated code can now be used on android with simple. Some things may
need to be fixed, since I didn't test yet with an XSD covering all concepts,
and because simpleframework defaults to require all elements (opposed to
jaxb). Expect fixes for emply lists, and enumerations of strings (Android
does not seem to return valueOf correctly when casing of remaining
letters does not match enum name).
Kind regards,
Dennis Bijwaard
|