users@jaxb.java.net

How to prevent JAXB generate classes for imported schema

From: kaneda <kaneda30_at_wp.pl>
Date: Wed, 05 Apr 2006 13:38:20 +0200

Hi All,

Anybody know how to prevent JAXB from generating classes for a
particular imported schema?

I'm importing the XML Digital Signature Schema but don't want to use
JAXB to (un)marshall.
I would like to obtain a reference to the Signature element as a DOM
element:


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns="mynamespace"
          targetNamespace="mynamespace"
          elementFormDefault="qualified"
          attributeFormDefault="unqualified"
          xmlns:xds="http://www.w3.org/2000/09/xmldsig#">

...

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/>


...

<xs:element name="MyElement">
       <xs:complexType>
           <xs:sequence>
               <xs:element ref="xds:Signature" minOccurs="0"
maxOccurs="1"/>
           </xs:sequence>
       </xs:complexType>
</xs:element>

In the xjb-file I have the following:

<jxb:bindings node="//xs:element[@ref='xds:Signature']">
   <xjc:dom/>
</jxb:bindings>

It seems to work fine, however, JAXB also generates classes for the
xds-namespace (ending up in the package "org.w3._2000._09.xmldsig_").
There's no interdependancy between the two packages so I could simply
delete it but I'm sure there's a more elegant way...

Any ideas?

Thanks in advance