You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Dogan Atay <DA...@aflac.com> on 2005/01/13 19:54:58 UTC

scomp question

Hi,
I have the following scenario:
I have a set of schemas;
common.xsd, sub11.xsd, sub12.xsd, app1.xsd.  
Each of these schemas has their own target namespaces.
These schemas are related to each other in the following way:
sub11 imports common
sub12 imports common
app1 imports sub11, sub12 and common

app1, sub11 and sub12 are application specific schemas whereas common.xsd is
a general purpose schema which can be imported by other schemas (i.e. sub21,
sub22, and app2) 

What I want is the following:
I want to scomp common.xsd and get a common.jar with all the common schema
types in it.

Then I want to scomp app1.xsd to generate app1.jar BUT I do not want it to
include the generated the schema types that are in common.jar already.

So I have generated common.jar, put that in the classpath and now ready to
scomp app1.  Is there a way, directly from scomp command options or
.xsdconfig, that I can accomplish this goal?


If there is not I guess I will end up with app1.jar and app2.jar which to
the most part will contain schema types from common.xsd.



Thanks,
 
Dogan Atay

Re: scomp question

Posted by David Jencks <da...@yahoo.com>.
This is easy to do if you use maven and the [geronimo]-maven-xmlbeans  
plugin.  I think there is a version in xmlbeans source but I don't know  
if it ever got released.

--make sure each  xsd is in a separate maven (sub) project
-- in each project.xml's dependency section list the modules whose  
schema you would like to be in the classpath.  A dependency should look  
something like this:

         <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-connector-builder</artifactId>
             <version>${pom.currentVersion}</version>
             <properties>
                 <xmlbeans>true</xmlbeans>
             </properties>
         </dependency>

the
             <properties>
                 <xmlbeans>true</xmlbeans>
             </properties>
part puts the dependency jar on the xmlbeans classpath.

In your maven.xml add a preGoal like:

     <preGoal name="java:compile">
         <xmlbeans:schema2java
             sourcedir="${basedir}/src"
             sourceschema="schema/geronimo-connector_1_5.xsd"
             xmlconfigs="${basedir}/src/schema/xmlconfig.xml"
             targetdir="${basedir}/target/xmlbeans"
              
cataloglocation="${basedir}/../j2ee-schema/src/catalog/resolver- 
catalog.xml"/>
     </preGoal>
indicating which schemas from the current project you wish to compile.

There are lots of examples of this in the geronimo project: most  
xxx-builder modules use this.

If nowhere else, the plugin is located at
http://www.ibiblio.org/maven/geronimo/plugins/geronimo-xmlbeans-plugin 
-1.0-M1.jar

thanks
david jencks

On Jan 13, 2005, at 10:54 AM, Dogan Atay wrote:

> Hi,
> I have the following scenario:
> I have a set of schemas;
> common.xsd, sub11.xsd, sub12.xsd, app1.xsd. 
> Each of these schemas has their own target namespaces.
> These schemas are related to each other in the following way:
> sub11 imports common
> sub12 imports common
> app1 imports sub11, sub12 and common
>
> app1, sub11 and sub12 are application specific schemas whereas  
> common.xsd is a general purpose schema which can be imported by other  
> schemas (i.e. sub21, sub22, and app2)
>
>  What I want is the following:
> I want to scomp common.xsd and get a common.jar with all the common  
> schema types in it.
>
> Then I want to scomp app1.xsd to generate app1.jar BUT I do not want  
> it to include the generated the schema types that are in common.jar  
> already.
>
> So I have generated common.jar, put that in the classpath and now  
> ready to scomp app1.  Is there a way, directly from scomp command  
> options or .xsdconfig, that I can accomplish this goal?
>
>
>
> If there is not I guess I will end up with app1.jar and app2.jar which  
> to the most part will contain schema types from common.xsd.
>
>
>
>
> Thanks,
>  
> Dogan Atay


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org