Questions tagged [jaxb2-basics]

JAXB2 Basics is an open source project which implements plugins and tools for JAXB 2.x reference implementation.

JAXB2 Basics is an open source project which implements plugins and tools for JAXB 2.x reference implementation. JAXB2 Basics is a part of the JAXB2 Commons project.

The implementation of JAXB2 plugins is available in this JAXB2 Basic project.

67 questions
56
votes
7 answers

Generating a JAXB class that implements an interface

I'm currently using JAXB to generate java classes in order to unmarshall XML. Now I would like to create a new schema very similar to the first and have the classes that are generated implement the same interface. Say for example, I have two schema…
Alex Spurling
  • 54,094
  • 23
  • 70
  • 76
17
votes
3 answers

Add toString, hashCode, equals while generating JAXB classes in Java

I'm trying to generate JAXB classes from an XSD file programmatically, using Java. I've used the following code snippet to achieve that: .... import java.io.File; import java.io.IOException; import org.xml.sax.InputSource; import…
Arka Ghosh
  • 845
  • 1
  • 11
  • 23
12
votes
2 answers

Programmatically use WsImport with JAXB plugins without Maven or ANT?

I am using WsImport to generate some Java sources from a remote WSDL file. Note that this is being from inside a regular Scala project i.e. it is not being done in a Maven or Ant build: import com.sun.tools.ws.WsImport def run(wsdlFile: File,…
pathikrit
  • 32,469
  • 37
  • 142
  • 221
11
votes
7 answers

Generating hashCode() and equals() when creating Java classes using Mojo Jaxb2 maven plugin

The code I'm working on is using jaxb2-maven-plugin from org.codehaus.mojo to generate Java classes from XSD schema. I'm looking for a way to automatically implement equals() and hashCode() methods for those classes, but it seems there is not a way.…
manub
  • 3,990
  • 2
  • 24
  • 33
10
votes
2 answers

Insert custom annotation in java 'field' using annotate plugin + JAXB (upon xsd -> java)

Use case: Wanna insert custom annotation to fields in java class generated by JAXB Problem: Using Annotate plugin + JAXB [1], am able to successfully insert custom annotations but they are getting inserted at getter method rather than field. Morphia…
Hari
  • 384
  • 1
  • 6
  • 20
8
votes
1 answer

Java Serialization, writeObject(Object obj) why not writeObject(Serializable obj)

The method signature of ObjectOutputStream's write method is public final void writeObject(Object obj) throws IOException As obj should implements Serializable (know about markers). Why java developers do not write this method as public final…
sailor
  • 753
  • 1
  • 6
  • 17
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
6
votes
1 answer

JAXB schema to Java Different XmlRootElement name and Class name

I have a xsd schema from which I'm generating some java classes. I'm using jaxb for the generation. I want to be able to generate a class annotated with @XmlRootElement, but I want the @XmlRootElement name property to be different than the name of…
Paulo Rodrigues
  • 593
  • 14
  • 32
4
votes
2 answers

JAXB 2.1 implementing Comparable for the generated Class

Using Jaxb 2.1 to generate java code from .xsd jaxb2-basics plug-in is used Wants to have generated Class Fragment to implement Comparable public class Fragment implements Serializable, Comparable { ... public int…
Rao
  • 20,781
  • 11
  • 57
  • 77
4
votes
1 answer

convert JAXBElement value to java string

I have a pojo class where return type of variable is JAXBElement. I want to store it in a String. Can someone explain how to do it? File file = new File("C:/Users/Admin/Desktop/JubulaXMLFiles/DemoWithDrools_1.0.xml"); …
Pyntamil Selvi
  • 161
  • 1
  • 6
  • 17
4
votes
2 answers

How to use jaxb plugin extensions with gradle-jaxb-plugin

I use gradle-jaxb-plugin to generate classes from an XSD: https://github.com/jacobono/gradle-jaxb-plugin It works fine with external binding and I can use the built-in XJC extensions without a problem. But I did not manage jaxb extension plugins to…
Boris Maizel
  • 111
  • 1
  • 4
4
votes
1 answer

Edit JAXB generated annotation using annox and add namespace in param

I do have the following annotation in a JAXB generated class @XmlType(name = "MessageInfoType", propOrder = { "debugTraceBoolean", "clientHostnameString", "endUserIPAddress" }) Need to produce the following annotation in JAXB class with…
user1631733
  • 111
  • 1
  • 3
  • 6
4
votes
1 answer

JAXB unmarshalling Custom entities without annotation

We have an xml file which we need to unmarshall(convert into a Java Object). Now the Java object is of third party and I cannot annotate it for unmarshalling. Any idea as to how I can Unmarshal without annotation. Please find my code snippet…
Sandeep Nair
  • 3,630
  • 3
  • 26
  • 38
3
votes
1 answer

Can jaxb2-basics be configured to specify an interface for a type variable of a generic object?

I am using jax-ws's wsimport to generate java classes from WSDLs. I am using the jaxb2-basics plugin to create toString, equals, hashCode, copy, and merge methods. I would like for the generated classes to implement interfaces to insulate our code…
David A
  • 490
  • 4
  • 10
3
votes
1 answer

XML parsing with Java (JAXB and Root Elements)

I am writing an XML parser in Java for a simple xml structure that has a structure that starts with Im able to read the entire XML structure just fine except this…
user3126404
1
2 3 4 5