Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to inform xjc not to go through xs:import?

Tags:

java

jaxb

ant

xsd

xjc

I want to create a java classes from the xsd using xjc ant task. Most of it works ok. I need it not to go through and because it already has mapping done. Here is xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:dsig="urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"
   xmlns:xmldsig="http://www.w3.org/2000/09/xmldsig#" 
   xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" 
   elementFormDefault="qualified"
  >
    <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" 
       schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" />
    <xs:import namespace="http://uri.etsi.org/01903/v1.3.2#" 
       schemaLocation="http://uri.etsi.org/01903/v1.3.2/XAdES.xsd" />
    <xs:import namespace="http://uri.etsi.org/01903/v1.4.1#" 
       schemaLocation="http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd" />
    <xs:element name="document-signatures">
        <xs:complexType>
            <xs:sequence minOccurs="1" maxOccurs="unbounded">
                <xs:element ref="xmldsig:Signature" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
 </xs:schema>

xjc goes through all imports and creates binding classes. But I already have those. So how to inform xjc to use already created bindings in the classpath? For xades implementation I'll use xades4j library

Thanks,

Vidmantas

like image 852
Vidmantas Avatar asked Oct 11 '22 10:10

Vidmantas


1 Answers

You can use episode files to do modular schema compilation:

  • JAXB - Creating modules for reuse
  • http://weblogs.java.net/blog/kohsuke/archive/2006/09/separate_compil.html?force=741
like image 66
bdoughan Avatar answered Oct 13 '22 00:10

bdoughan