Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Michael Cox   on Oct 31 In Java Category.

  
Question Answered By: Tamara Nguyen   on Oct 31

I have an experience in this field,
At first, you should have an Schema that jaxb  create Objects from it.
and then you should write an ant task to do it (create objects from schema).
the lib should be these jar files :

1- activation.jar
2- jaxb1-impl.jar
3- jaxb-api.jar
4- jaxb-impl.jar
5- jaxb-xjc.jar
6- jsr173_1.0_api.jar

and ant task should be like this :


<property name="jaxb.home" value="."/>

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath refid="build.classpath"/>
</taskdef>

<target name="JAXB" description="Compile all java  source files">
<echo message="Compiling the schema..."/>
<xjc schema="view/schema/opxiActivityLog.xsd" package="com.project.opxi.manager.adaptor.JaxbObject" destdir="${opxi.src.dir}">
<produces dir="${opxi.src.dir}/com/project/opxi/manager/adaptor/JaxbObject/JaxbObject" includes="**/*.java" />
</xjc>
<echo message="Compiling the java source files..."/>

<javac destdir="${classes.dir}"
debug="true"
fork="true"
source="1.5"
classpathref="build.classpath">
<src path="${opxi.src.dir}/${src.classes.prefix}/adaptor/JaxbObject"/>
<!--<classpath refid="build.classpath" />-->
</javac>
</target>

and then you could get these Objects.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Could u please tell me how can I plug-in JAXB to JBuilder? Or get search suggestion and latest updates.


Tagged: