users@jaxb.java.net

Re: Multiple schema and maven plugin

From: Josyula Jagadeesh <josyulajj_at_yahoo.com>
Date: Tue, 5 Jun 2007 21:10:42 -0700 (PDT)

Many thanks!

I have the following error message with my maven compile

[ERROR] [ERROR] XPath evaluation of "/xs:schema" results in empty target node.

My XML schema dose have xs,

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"

My maven POM plugin


    <plugins>
      <plugin>
        <groupId>com.sun.tools.xjc.maven2</groupId>
        <artifactId>maven-jaxb-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <schemaDirectory>src/main/resources/</schemaDirectory>
          <includeSchemas>
            <includeSchema>*.xsd</includeSchema>
         </includeSchemas>
        <includeBindings>
            <includeBinding>main.xjb</includeBinding>
        </includeBindings>
          <generateDirectory>src/main/java</generateDirectory>
           <removeOldOutput>true</removeOldOutput>
          <verbose>true</verbose>
        </configuration>
      </plugin>


Thanks

----- Original Message ----
From: Aleksei Valikov <valikov_at_gmx.net>
To: users_at_jaxb.dev.java.net
Sent: Tuesday, June 5, 2007 3:03:19 PM
Subject: Re: Multiple schema and maven plugin

Hi.

I have two xml schemas, i need to generate the jaxb classes in two different

packages. How can i configure the maven-jaxb2-plugin for this scenario.
Use bindings to specify which schema goes in which package.

If you're using JAXB 2.x, use maven-jaxb2-plugin (see
maven-jaxb2-plugin.dev.java.net)

Bye.
/lexi

ps. Here's an example of bindings:

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings
        version="
2.1"
        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
        xmlns:xs="http://www.w3.org/2001/XMLSchema
"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">
    
    
    <jaxb:bindings schemaLocation="
rim.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.freebxml.omar.jaxb.bindings.rim"/>
        </jaxb:schemaBindings>

    </jaxb:bindings>
    
    <jaxb:bindings schemaLocation="rs.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.freebxml.omar.jaxb.bindings.rs
"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
    
    <jaxb:bindings schemaLocation="lcm.xsd" node="/xs:schema">
        <jaxb:schemaBindings>

            <jaxb:package name="org.freebxml.omar.jaxb.bindings.lcm"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
    
    <jaxb:bindings schemaLocation="query.xsd
" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.freebxml.omar.jaxb.bindings.query"/>
        </jaxb:schemaBindings>

    </jaxb:bindings>
    
    <jaxb:bindings schemaLocation="cms.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.freebxml.omar.jaxb.bindings.cms
"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>

    <jaxb:bindings schemaLocation="mtom-transport.xsd" node="/xs:schema">
        <jaxb:schemaBindings>

            <jaxb:package name="org.freebxml.omar.jaxb.bindings.mtomtransport"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
</jaxb:bindings>








       
____________________________________________________________________________________
Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/