Questions tagged [xjb]

xjb is a configuration file that is used to customize the default binding behaviour of the JAXB compiler.

The xjb file extension is related to JAXB (Java Architecture for XML Binding) and its binding compiler.

This file allows to customize the JAXB Bindings, when it is needed to modify the default bindings defined through the JAXB compiler. The file contains a set of binding declarations, e.g.:

<jxb:bindings version="1.0" 
  xmlns:jxb="http://java.sun.com/xml/ns/jaxb" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
  jxb:extensionBindingPrefixes="xjc">
    <jxb:bindings schemaLocation="po4.xsd" node="/xs:schema">
        <jxb:globalBindings>
            <xjc:superClass name="com.syh.Shape"/>
            <xjc:serializable uid="12343"/>
        </jxb:globalBindings>
        <jxb:bindings node="//xs:element[@name='Widgets']//xs:complexType//xs:choice">
            <jxb:property name="Shapes"/>
        </jxb:bindings>
    </jxb:bindings>
</jxb:bindings>

(this sample comes from O'Reilly onjava.com)

The xjc compiler may be invoked like so:

xjc <schema.xsd> -b <file.jxb>

See also:

40 questions
7
votes
3 answers

How to generate *.xjb file from WSDL?

I have a WSDL file weatherservice.wsdl and I am trying to generate binding for this WSDL using xjc. How do I do this using xjc? I did not find any command line args to do it from xjc. xjc -p com -wsdl weatherservice.wsdl
Tito
  • 8,894
  • 12
  • 52
  • 86
7
votes
1 answer

JAXB Simplify plugin still usable?

I tried the solution of the question here JAXB Simplify plugin vs *.xjb. but it failed with the following exception " compiler was unable to honor this simplify:as-element-property customization. It is attached to a wrong place, or its inconsistent…
Yinan
  • 83
  • 6
4
votes
1 answer

Hyperjaxb: Exclude XML Element by XML property

I have a predefined XSD that looks as follows: ...
Erzen
  • 169
  • 10
4
votes
2 answers

Using XJB with jaxb2-maven-plugin

I have a multi-module maven project in the following structure: root-module |__module-a | |__src | |__main | |__xsd | | |__my.xsd | |__xjb | |__my.xjb …
Neel
  • 2,100
  • 5
  • 24
  • 47
4
votes
1 answer

JAXB Simplify plugin vs *.xjb

I'm trying to use the Simplify plugin to replace a complex property with a set of simpler ones. I made it working following the plugin's manual. But I can't change the original schema, so I have to use an external bindings.xjb. And it gives me all…
4
votes
1 answer

Change the name of generated variable for referenced element in XSD using Jaxb and bindings

Today I have a mindboggler I just cannot solve. I will start with an Explanation and Example. I have 2 XSD Files. The one XSD File References one of the other's elements. First XSD- ReportInfo.xsd:
Eon
  • 3,833
  • 10
  • 46
  • 75
3
votes
1 answer

JAXB property order

I have an XSD file. Using xjc I generate classes from it. How can I change the propOrder value from XmlType annotation in generated clases? I don't want to change XSD file as long as I am not an owner of it and I don't want to change classes…
Mikhail
  • 4,175
  • 15
  • 31
2
votes
0 answers

XJC fails when backslash in schema import and bindings specified

I want to generate Java classes from an XSD with xjc (version 2.3.0-b170531.0717) Unfortunately the XSD imports another XSD given in a relative path with Windows path separators (backslash \), which is stated as an excluded character according to…
Madjosz
  • 509
  • 1
  • 5
  • 13
2
votes
0 answers

wsimport is already defined

I'm dealing with a remote WSDL in which some XSD are invoked twice. I'm trying to use xjb binding to get rid of 'EndpointReference' is already defined riga 22 di file:...../wsdl/ws-addr.xsd (related to above error) the first definition…
davidetrapani
  • 540
  • 2
  • 7
  • 16
2
votes
2 answers

Error in jaxb2-maven-plugin XJB: The namespace of element 'bindings' must be from the schema namespace'

I am attempting to assign different name spaces to different xsd files and use jaxb2-maven plugin to build the artifacts defined by these xsd files. Maven fails to generate the source with the following error: The namespace of element 'bindings'…
Half_Duplex
  • 5,102
  • 5
  • 42
  • 58
2
votes
2 answers

getting error only one globalBindings customization is allowed in a whole compilation while using maven-jaxb2-plugin

I am using maven-jaxb2-plugin. Here is my plugin configuration org.jvnet.jaxb2.maven2 maven-jaxb2-plugin xjc-serviceoperations
Basit
  • 8,426
  • 46
  • 116
  • 196
2
votes
1 answer

How to create the binding file for changing complexType to simpleType

I had a field in XSD schema: In java class was generated…
Gorgoth
  • 121
  • 3
2
votes
1 answer

Is it possible to create a single class mapping for identical xs:simpleContent elements?

I have an externally supplied XSD which has many elements all which are identical and represent a price with optional currency attribute.
Brett Ryan
  • 26,937
  • 30
  • 128
  • 163
1
vote
0 answers

org.xml.sax.SAXParseException: 'GovernmentIDType' is already defined

I a trying to generate Java classes from XSDs provided by third party. However I am getting the error…
1
vote
1 answer

XJC binding file: override package based on namespace instead of schemaLocation

I'd like to override package for my schema via binding .xjb file. It is done with: JXC compiler expects context for above code, defined via schemaLocation. I store .xsd and…
gavenkoa
  • 45,285
  • 19
  • 251
  • 303
1
2 3