Blaise Doughan

Greenhorn
+ Follow
since Aug 25, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Blaise Doughan

Have you considered using JAXB? It is the Java standard (JSR-222) for converting Java objects to/from XML. For an example of running MOXy JAXB's schema to class compiler see:

- http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/Compiler
JAXB is the java standard (JSR-222) for mapping Java Objects to XML:

- http://bdoughan.blogspot.com/2010/07/jaxb-xml-binding-standard.html

There are multiple implemenations of JAXB available:
- Metro (https://jaxb.dev.java.net/)
- MOXy (http://www.eclipse.org/eclipselink/moxy.php)
- JaxMe (http://ws.apache.org/jaxme/)

For a simple JAXB example see:
- http://wiki.eclipse.org/EclipseLink/Examples/GettingStarted

For an advanced MOXy example see:
- http://bdoughan.blogspot.com/2010/09/xpath-based-mapping-geocode-example.html
You can specify the @XmlJavaTypeAdapter annotation at the class level. This means that that any property of this particular class will automatically use the adapter. Unfortumately the adapter does not get activated when this object is the root object of the tree. In this case you need to call the adapter yourself.
In the previous post I had entered the wrong property name, it should have been:


We saw that the problem existed in versions 17 to 20. Did you try the property?
This is a bug, it can be solved by upgrading to the latest version of the JDK or by setting the following property:



EDIT: Corrected property name
The MOXy JAXB implementation (http://www.eclipse.org/eclipselink/moxy.php) uses what ever JAXP parsers are configured for your VM. I believe the Metro JAXB implementation (https://jaxb.dev.java.net/) also works this way.