Questions tagged [xjc]
XJC is a JAXB tool for compiling XSD (XML Schema) to Java source code.
739
questions
0
votes
1
answer
67
views
Best way to handle identical data within two different Java types generated from XSD files
I am pretty much stuck finding the best way to solve this.
My case is that I have a provider which gives me XSD files to generate the types I will use to call their SOAP api. Those XSD files sometimes ...
0
votes
0
answers
34
views
How to access xsi:type attribute of a xs:anySimpleType element in xjc generated class?
I need to marshal and unmarshal XMLs that contains structures like this:
<Parameter>
<Name>Country</Name>
<Value xsi:type="xsd:string">Uruguay</Value>
&...
0
votes
1
answer
214
views
Using the JAXB2 Simplify Plugin together with Java 17 and jaxb2-maven-plugin of codehaus
Starting of with a project that has jaxb2-maven-plugin and the Highsource jaxb2-basics plugin for the Maven-plugin jaxb2-maven-plugin I was able to use the Highsource "JAXB2 Simplify Plugin"....
0
votes
1
answer
69
views
Attribute jaxb:extensionBindingPrefixes is not allowed here
I've checked out one project and trying solving some problems in IntelliJ IDEA 2023.2.1. In one of the maven project I've got following xjb file:
<?xml version="1.0" encoding="UTF-8&...
0
votes
0
answers
19
views
Let xjc NOT use inheritance for XSD inheritance
I have this XSD/WSDL:
<xs:complexType name="SupplierArticle">
<xs:complexContent>
<xs:extension base="Article">
<xs:attribute name=&...
0
votes
1
answer
90
views
hisrc-higherjaxb-maven-plugin generates source code for an xsd file but doesn't annotate all elements in ObjectFactory with XmlElementDecl
Here's(onvif.xsd) the schema file I'm trying to generate the source code for, using hisrc-higherjaxb.
Here's part of my pom.xml configuration,
<plugin>
<groupId>org.patrodyne.jvnet</...
-1
votes
1
answer
94
views
XJC throws java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException after migrating JAXB from javax to jakarta
What I'm trying to achieve
Move Spring application (not Spring boot) from Java 8 to 17 and Tomcat 8 to 10.
Issues
After following this question I have replaced javax libraries(mostly for xml ...
0
votes
0
answers
30
views
Issue with JAXB and xjc: Parsing xs:decimal with minExclusive constraint when building the project
I am facing an issue with JAXB and xjc while generating Java code from an XML schema (XSD) that includes an xs:decimal element with a minExclusive constraint. Despite specifying the type as xs:decimal ...
0
votes
2
answers
82
views
JAXB 3 with property change support in setter methods
In the past there existed the property-listener-injector plugin for the org.jvnet.jaxb2maven plugin.
One can still find the plugin in maven central repo : org.jvnet.jaxb2-commons:property-listener-...
1
vote
0
answers
70
views
Is the property "accessExternalSchema" still relevant in current versions of xjc and jaxws-maven-plugin?
While updating our Spring Boot projects to Spring Boot 3 we also updated the JAX-WS Maven Plugin dependency to the one hosted by the Eclipse Foundation. We use the following plugin configuration:
<...
1
vote
1
answer
382
views
Converting XSD / XJB to Java Classes with JAXB 3.0 and jaxb2-maven-plugin does not work for Annotations (-Xannotate xjc switch)
I am trying to migrate my Java class generation from the former javax.* to jakarta.* I am using the Maven Plugin
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin&...
0
votes
0
answers
22
views
XJC does not generate jaxb binding basetType class
I want to generate a hashmap to hold the elements under an element. So that I can fetch or update these elements in a single call. So I tried generating a binding file for this. But it never generates ...
0
votes
0
answers
45
views
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
<xs:complexType name="PartyIdentification135">
...
0
votes
0
answers
22
views
using jaxws binding with required=false
We have a bunch of .wsdl files and have defined an execution goal for each one of them, each with their own bindings file. That makes 71 execution goals and 71 bindings files with mostly the same ...
0
votes
0
answers
85
views
How to run com.sun.tools.xjc.XJCTask twice with different parameters in build.gradle?
My goal is to generate java classes from two xsd schemas and place them in defined packages, i.e classes from first.xsd goes to com.example.first package, and second.xsd to com.example.second.
Sounds ...
0
votes
1
answer
163
views
JAXB XJC use String as type if there is no type set in xsd
I'm trying to generate JAXB Classes with XJC and maven-jaxb2-plugin. It works, but if there is no type specified on the element in the .xsd it uses Object for the Java Type. I would like it to use ...
0
votes
0
answers
91
views
Failed to read schema document 'xsd', because 'zip' access is not allowed due to restriction set by the accessExternalSchema property
I have upgraded my ant build project from Java 6 to Java 8, Weblogic 10 to weblogic 12c and from spring 3 to Spring 5.
When i try to build my project it gives me the error,
"**[xjc] [ERROR] ...
0
votes
1
answer
95
views
Update of XJC / Jakarta causes `Map<QName, String> otherAttributes` to be generated, which subsequently causes runtime issues
Upgrading to jakarta caused some issues for me.
I'm using the following maven plugin:
<groupId>org.patrodyne.jvnet</groupId>
<artifactId>hisrc-higherjaxb40-maven-plugin</...
0
votes
0
answers
54
views
Property 'contentForWildcard' has redundant after migrating to Gradle 7.4 from 6.8
I'm using the gradle-xjc-plugin (Version: 1.4.2) to generate required classes from WSDL. the xjcGenerate task in my gradle worked fine until I migrated the gradle version to 7.4 from 6.8.
xjcGenerate {...
0
votes
1
answer
165
views
patrodyne/hisrc-hyperjaxb maven plugin exclude precision and scale from @Column for Double fields
My situation is close to this question. I use patrodyne/hisrc-hyperjaxb maven plugin to generate entity classes with JPA annotions from xsd schema along with krasa-jaxb-tools plugin, which add ...
2
votes
1
answer
701
views
How to make JAXB use custom namespace prefixes
When marshalling an object to XML with JAXB, it automatically generates namespace prefixes like ns2:. The system I have to communicate with unfortunately doesn't work with these default prefixes (...
0
votes
0
answers
27
views
xsd to object with included xsd which contains same name elements
I have 4 xsd-s. The main xsd include an other one with contains same name elements and I have a catalog.xml. The company policy doesn't allow to change these xsd-s (don't ask why)
If I generate java ...
0
votes
1
answer
194
views
Getting java.lang.Error: java.lang.reflect.InvocationTargetException in ant build.xml while using openjdk11
xjc tool configuration on my ant build.xml is
<xjc destdir="${src.java.generated.dir}" package="task.config" readonly="false" removeOldOutput="yes" extension=...
0
votes
2
answers
318
views
Up-to-date Documentation on JAXB Bindings for XSD and DTD
I'm trying to generate classes from XSD and DTD files while adding some customizations (have the generated classes implement an interface).
I found this thread about XSD bindings, however, it no ...
0
votes
0
answers
43
views
How to Generate Java Classes from WSDL and Add Custom Annotations with SOAPAction Value?
I need to generate java classes from wsdl and add custom annotation to them with value SoapAction. This value should be taken from wsdl.
I tried to make a custom plugin. I made class extended from com....
0
votes
0
answers
49
views
How to remove namespaces in the root element of the generated class file when using XSD files using XJC compiler
How to remove namespaces in the root element of the generated class file using XSD files using xjc plugin to compile. I am using JDK17 and Jakarta. I want to keep namespace only to the child elements ...
0
votes
0
answers
15
views
Generate a java class via xsd and also add a class attribute not present in the xsd file
I'm sorry for my bad english, I periodically receive this xsd file with slight updates, and from this file I generate a class via xjc, I would like that in addition to what is specified in the file, ...
1
vote
2
answers
371
views
JAXB: xsd + xjb to POJO without annotations
I got stuck trying to convert a XSD + XJB file to a POJO that has no JAXB annotations inside its code.
Project structure:
pom.xml
src/main/resources/schema.xsd
The file schema.xsd can be found here ...
0
votes
0
answers
38
views
JAXB How to add namespace URL as an attribute of the element
I am new to JAXB library and not able to get the solution for adding xmlns to the elements in XML and get rid of default namespaces (like ns2, ns3). I have generated the POJOs using wsimport command.
...
0
votes
1
answer
437
views
XJC 4.0.1 Producing Error "External parsing is disabled" Despite Turning Feature On in jaxp.properties
I am getting an error using XJC 4.0.1 on Windows 10 while attempting to generate Java source from a DTD:
C:\Users\mbmas_000\workspace\EnergyMeterMonitor>"C:\Program Files\Java\jdk-17.0.3.1\bin\...
1
vote
0
answers
209
views
JAXB XJC: how to skip class generation for an imported namespace?
I'm generating the Java classes corresponding to the XML-Schema at
https://cwe.mitre.org/data/xsd/cwe_schema_v6.10.xsd
but most of the generated classes are undesired since they belong to the imported ...
0
votes
0
answers
52
views
jaxb2 & xjc - generate fields with inherited type
I'm having some trouble with an xsd that was supplied to us. I'm not really sure how to describe my issue without example so I created a test xsd that has the same issue.
Here's the xsd:
<?xml ...
0
votes
0
answers
290
views
JAXB XJC - Dynamically adding fields to generated models from .xsd
I'm using jaxb2-maven-plugin version 3.1.0 to generate models from an .xsd schema file. I created an object called BookContext that has the following declaration:
package com.xmltesting;
import ...
0
votes
0
answers
33
views
Class generation with xjc and/or jaxb
Given a .xsd file such as
<xs:element name="SHRTC">
<xs:annotation>
<xs:appinfo>
<aa:longname>ShortCut</aa:longname>
...
0
votes
1
answer
86
views
maven-jaxb2-plugin generates uncompilable code when using episode from org.jvnet.ogc/gml-v_3_2_1
I am trying to generate JAXB classes for the AIXM XSDs, which unfortunately are quite complicated and reference the even more complicated OGC GML 3.2.1, xlink and ISO 19139 schemas. I would like this ...
0
votes
0
answers
72
views
In JAXB, is it possible to define annotations that allow embedding a xs:sequence within a xs:choice?
I am creating a Java class with JAXB annotations, and I'm trying to match the following XSD type definition:
<complexType name="TVAMediaLocatorType">
<sequence>
<...
0
votes
0
answers
117
views
Two declarations cause a collision in the ObjectFactory class
I have xsd specification from external source without option to change anything.
There are two elements inside like this:
<xs:sequence>
<xs:element ref="p_C.2.1.1" />
<...
2
votes
1
answer
5k
views
jaxb2-basics-annotate plugin migration to jaxb 3.0 and jakarta namespace
Years ago I have developed a maven archetype for creating a skeleton project that uses an xsd schema and a global.xjb to generate jaxb classes through xjc.
It is based on com.evolvedbinary.maven.jvnet:...
3
votes
0
answers
70
views
Jaxb unmarshall classes located in parent package
I have several xsd's corresponding to different versions ( identified via different namespace ). However among these xsd's there are various complex types which are common across them. Hence there are ...
5
votes
0
answers
333
views
How to configure jaxb/xjc to generate only one class instead of duplicates from imported complexType in more xsd-s?
Suppose I have 2 xsd-s. The first declares type A. The second imports the first xsd (import namespace, xmlns:ns=... etc.) and declares type B, which extends type A (base="ns:B"). Like this:
&...
0
votes
1
answer
405
views
Problem with adding annotation for JAXB created classes
I'm using maven-jaxb2-plugin to generate my models based on .wsdl file. Now I need to add annotation to one of the classes. I tried to use jaxb2-basics-annotate and was very close to succeed, but now ...
0
votes
1
answer
452
views
gradle XJC task creates schema as a separate module
I have created the following build.gradle file which generates Java classes from xsd file and puts those generated classes into a package which is separately created from the main package inside src/...
0
votes
1
answer
105
views
How do I "import" an xml schema for xjb code generation
I'm new to using xml, and having trouble figuring this out. I found a schema for the RSS spec online, and I can generate java classes from that self-contained schema using xjc without issues.
I want ...
2
votes
1
answer
153
views
isSet methods not generated using jaxb2-basics simplify plugin
I have a schema with two elements within a <xs:choice/> block, as per the following fragment:
<xs:complexType name="POCD_MT000040.Component2">
<xs:sequence>
<...
1
vote
1
answer
714
views
XJC Generating Java objects on different packages using maven jaxb2 plugin
In my resources folder src/main/resources, I have an xsd folder with subfolders named create and update.
So the folder structure looks like :
src/main/resources/xsd
src/main/resources/xsd/create/...
0
votes
1
answer
254
views
jaxb2-basics and inheritance
I am successfully using jaxb2-basics for inheritance support. I am trying to add some more inheritance but cannot figure out how to do that in a specific situation. I have this XSD fragment:
<xsd:...
3
votes
0
answers
447
views
XJC - Add Lombok Annotation on top of every Generated XSD class and remove Setters Getters
I am working on jaxb2-maven-plugin, I am generating Java POJOs from XSD.
I need to add @Data annotation on top of the class without setters getters.
The output file should look like this.
@Data
public ...
12
votes
2
answers
9k
views
Why does jaxb2-maven-plugin xjc fail with Corretto jdk11.0.15_9 but not with Temurin jdk-11.0.14.1+1
Since upgrading my jdk to Corretto jdk11.0.15_9 the xjc goal of jaxb2-maven-plugin fails.
The problem doesn't manifest when running with Temurin jdk-11.0.14.1+1. I'm running it on windows 10 with ...
1
vote
0
answers
152
views
JAXB XJC - How to generate classes for xsd simpleType
I'm trying to generate java classes using maven jaxb plugin starting from an xsd schema. Everything is fine. I need just a refinement.
Simple types like this in the xsd schema
<xs:simpleType ...
3
votes
2
answers
10k
views
How to run jaxb xjc task with gradle?
I picked up 3 gradle plugins for jaxb/xjc and none of them worked for me.
For each case, I've put the maven model xsd maven-4.0.0.xsd https://maven.apache.org/xsd/maven-4.0.0.xsd in src/main/xsd. (it'...