• Post Reply Bookmark Topic Watch Topic
  • New Topic

Castor source-gen Help  RSS feed

Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using sourceGen of castor:

<target name="castor" depends="init" description="Generate Java source files from XSD.">
<path id="castor.class.path">
<pathelement location="${lib}/castor-1.0.jar"/>
<pathelement location="${lib}/castor-1.0-xml.jar"/>
<pathelement location="${lib}/castor-1.0-commons.jar"/>
<pathelement location="${lib}/castor-1.0-srcgen-ant-task.jar"/>
<pathelement location="${lib}/xerces-J_1.4.0.jar"/>

<taskdef name="castor-srcgen"
classpathref="castor.class.path" />

<mkdir dir="${srcroot}/igt/atg/ibe/castor" />
<castor-srcgen file="${srcroot}/igt/atg/ibe/castor/schema1.xsd"
package="castor" warnings="false"/>

All .java files generated in ${srcroot}/igt/atg/ibe/castor package--


* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.0</a>, using an XML
* Schema.
* $Id$

package castor;

//- Imported classes and packages -/

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;

* Class Address.
* @version $Revision$ $Date$
public class Address implements java.io.Serializable {
Problem is:
1) There are few comments before package statement (autogenerated)..thats doesn't let it compile. (whats solution to avoid it?)

2) Actual package statement should be
package com.igt.atg.ibe.castor;

but if i write this
package="com.igt.atg.ibe.castor" warnings="false" in AntTask.. it stores all *.java files in com.igt.atg.ibe.com.igt.atg.ibe.castor.

how to get right package statement (package com.igt.atg.ibe.castor)
in generated .java files.?

thanks n regards,
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try chainging the toDir from ${srcroot}/igt/atg/ibe to ${srcroot} and specify the package value as "com.igt.atg.ibe.castor" assuming srcroot value is "com".
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!