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
1
vote
0 answers

Generate JAXB class with constant from XML schema file and XJB binding

Currently i have to hard-code the schema version (or parse it) manually in java code when working with generated JAXB classes. This can easily lead to mistakes when changing the XML schema version and feels wrong. What i want is to specify the…
Lesurglesum
  • 515
  • 4
  • 10
1
vote
0 answers

JAXB XJC file generation - how to change the namespace

so I am using a binding.xjb file to generate classes from XML files. My main problems is that every XML file begins like this:
nxn
  • 89
  • 1
  • 10
1
vote
1 answer

Make xjc generate class with member variable names exactly same as element names

Is there a way to specify in external binding that the member variable names in generated classes should follow the same letter case (and not the java conventions), on a schema level (i.e. not a globalbinding)? I am having elements named as…
Naveed S
  • 5,106
  • 4
  • 34
  • 52
1
vote
2 answers

XJB and JAXB binding on simpleType with same name

I'm trying to generate JAVA code with jaxb and spring but I can't get it to work when I have as wsdl file with 2 simpleTypes with the same name but in different namespaces. Does anyone know how I can solve this? I've been trying out the…
olahell
  • 1,931
  • 3
  • 19
  • 35
1
vote
1 answer

JAXB: how to specify that a binding rule that a complexType is generated by a different XSD?

I have a couple of comprehensive XSDs which inlcude the same complexType definition for the same member. Each XSD has its own namespace. So when I run xjc on the xsds, I get the same complexType class generated in each namespace. This ends up being…
Eric B.
  • 23,425
  • 50
  • 169
  • 316
1
vote
1 answer

JAXB XmlAdapter via bindings file

Consider this XSD:
Markus Ratzer
  • 1,292
  • 3
  • 19
  • 29
1
vote
0 answers

Inject annotation with xjc and custom binding file

Well, I've got this external (and old) WSDL structured like this:
Gunnar
  • 383
  • 4
  • 18
1
vote
1 answer

XPATH results empty target node in XJB

I have got the following simple XML Schema...
user3555138
  • 11
  • 1
  • 2
0
votes
0 answers

JAXB - How to customize simpleType of an element using external custom binding

I'm generating a set of pojos using xjc from a xsd schema and a xjb customization file. The schema define a complex type like this
Federico
  • 35
  • 1
  • 5
0
votes
0 answers

Jakarta XML Schema is not present when updating to Java 17 and JAXB 3

I'm currently updating our application to Java 17 and JAXB 3. I switched to the jaxb30-maven-plugin for this com.evolvedbinary.maven.jvnet jaxb30-maven-plugin 0.15.0 Now I'm getting the…
pemko
  • 69
  • 9
0
votes
0 answers

Jaxb2 generate class with constructor with more than 270 fields

my complexType has lots of elements. During build it fails on this error: .java:[1063,12] too many parameters I have in pom.xml this: -Xannotate -Xfluent-api
0
votes
1 answer

JAXB - When property already defined and using bindings it's not working with *complexContent*

Using JAXB to generate Java classes. I'm using the following XSD scheme.
0
votes
0 answers

Marshall xsd:any content as string with JAXB

I am searching for an solution for the following problem. I have xml content which looks like this: 8.1. chapter title
Timster
  • 1
  • 2
0
votes
1 answer

Maven-Jaxb2 Plugin Type references Are throwing Already Defined Errors

I'm new with Jaxb plugin to generate models. I have 2 xsd file , where one xsd is referencing type in other xsd common.xsd
edwin
  • 7,985
  • 10
  • 51
  • 82
0
votes
1 answer

Schema element references undefined type. Create SOAP client service. How to take into account binding customization of the generated classes?

I have converted WSDL to Java classes, however, I needed to use binding file and suffix added to resolve conflicts. I received classes successfully however with slightly changed type names. When I try to create WebService using JaxWsProxyFactoryBean…
Kirill Ch
  • 5,496
  • 4
  • 44
  • 65