how to compile xsd into a set of equivalent java objects using moxy?

170 views Asked by At

I'm looking to use JAXB however since I have a lot of attributes that I need to pluck out of my xmls I would prefer to use xpath queires instead of doing it through the dot notation on my java objects.

My questions :

  1. Is there a different routine/tool to generate my java object graph while using moxy? I mean is there any xjc equivalent in Moxy ?
  2. If not I'm assuming I can use the xjc output and then work with moxy.

My interest in moxy usage is to work with xpath queries on the object graph that xjc generates.

Also,can anybody tell how moxy compares to jxpath from Apache ?

1

There are 1 answers

0
miran On

When you download eclipseling dist, you find script

eclipselink/bin/jaxb-compiler.sh

It reuses xjc from JAX-B RI to generate java classes plus it generates property file -

jaxb.properties 

containing

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory

ensuring that Eclipselink MOXy is used at runtime (not JAXB RI). In other words, you should be able to generate classes with xjc aswell, you only need to add property file. If using xjc, you also may use different version of xjc from one MOXy was tested.