This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Cannot compile XSD using JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Cannot compile XSD using JAXB" Watch "Cannot compile XSD using JAXB" New topic
Author

Cannot compile XSD using JAXB

mou haj
Ranch Hand

Joined: Sep 12, 2001
Posts: 81
I have a a couple of XSDs and a common XSD is reffered in all XSDs and I cannot compile them to a class file:

My XSD :
-------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSPY v2004 rel. 4 U (http://www.xmlspy.com)-->
<xs:schema targetNamespace="http://www.ctb.com/MONARCHINTERFACE" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ctb.com/MONARCHINTERFACE">
<xs:annotation>
<xs:documentation>
This is the XML Schema for Monarch Interface - Shared Stimulus
</xs:documentation>
</xs:annotation>
<xs:element name="SharedStimulus">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="SharedStimulusSpec" type="ICommon.ctSSSpecType"/>
<xs:sequence>
<xs:element name="Passage" type="ICommon.ctElementType" minOccurs="0"/>
<xs:element name="OtherSharedStimulus" type="ICommon.ctElementType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SourceDoc" type="ICommon.ctSourceDocType"/>
<xs:element name="Renditions" type="ICommon.ctRenditionsType"/>
</xs:sequence>
</xs:sequence>
<xs:attribute name="MonarchId" type="xs:string" use="required"/>
<xs:attribute name="ExternalId" type="xs:string" use="required"/>
<xs:attribute name="type" type="ICommon.stSharedStimulusType" use="required"/>
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:attribute name="title" type="xs:string" use="optional"/>
<xs:attribute name="author" type="xs:string" use="optional"/>
<xs:attribute name="copyright" type="xs:string" use="optional"/>
<xs:attribute name="PatternIndicator" type="ICommon.stBoolean"/>
</xs:complexType>
</xs:element>
</xs:schema>
-------------------------------------------------------

You can see in "<xs:element name="SourceDoc" type="ICommon.ctSourceDocType"/>" ICommon referred which is another XSD (ICommon.xd)

I am trying to comiple them using the build.xml
********************************************************************
<?xml version="1.0"?>

<!--
Copyright 2003 Sun Microsystems, Inc. All rights reserved.
-->

<project basedir="." default="run">

<!-- if you are not running from $JWSDP_HOME/jaxb/samples AND you
are using your own version of Ant, then you need to specify
"ant -Djwsdp.home=..." -->

<property name="modelMisc.classes" value="C:/jwsdp-1.3/jwsdp-1.3/jaxb/samples/unmarshal-read/classes" />
<property name="modelMisc.outputJar" value="modelMisc.jar" />
<property name="jwsdp.home" value="C:/jwsdp-1.3/jwsdp-1.3/" />
<property name="jaxb.home" value="C:/jwsdp-1.3/jwsdp-1.3/jaxb/" />

<path id="classpath">
<pathelement path="." />
<!-- for use with bundled ant -->
<fileset dir="${jwsdp.home}" includes="jaxb/lib/*.jar" />
<fileset dir="${jwsdp.home}" includes="jwsdp-shared/lib/*.jar" />
<fileset dir="${jwsdp.home}" includes="jaxp/lib/**/*.jar" />
<fileset dir="${jaxb.home}" includes="lib/*.jar" />

</path>

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">

<classpath refid="classpath" />
</taskdef>

<!-- compile Java source files -->
<target name="compile">

<!-- generate the Java content classes from the schema -->
<echo message="Compiling the schema..."/>


<xjc target="." package="primer.po" >
<schema dir="." includes="SharedStimulusInterface.xsd" />
<arg value="-nv" />

</xjc>


<!-- generate the javadocs from the content classes -->
<mkdir dir="docs/api"/>
<javadoc packagenames="primer.po"
sourcepath="."
destdir="docs/api"
windowtitle="Generated Interfaces for po.xsd">
<classpath refid="classpath" />
</javadoc>

<!-- compile all of the java sources -->
<echo message="Compiling the java source files..."/>
<javac srcdir="." destdir="./classes" debug="on">
<classpath refid="classpath" />
</javac>

<zip basedir="${modelMisc.classes}" zipfile="${modelMisc.outputJar}" encoding="UTF8"/> <!-- JARs filenames are encoded UTF8 -->



</target>


</project>

********************************************************************

Please help, This build file compiles XSDs (where no other XSD has been reffered to).. but is failing when one xsd ia calling another XSD.

Any kind of help is appreciated.

Thanks
Mou
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot compile XSD using JAXB
 
Similar Threads
JAXB in eclipse
JAXB - Weird Problem in unmarshling
Why 'gen-src\primer.po is not found'?
JAXB XJC compiling Issue
[JAXB] Not able to generate IMPL file using xjc