Questions tagged [jaxb2]

For issues relating to the JAXB XML binding architecture, version 2.

Java Architecture for XML Binding (JAXB) is the Java standard (JSR-222) for working with XML as domain objects. It provides an easy to use mechanism for mapping Java classes to XML representations. An implementation is included as part of the Java SE 6 API. There are several implementations available including Metro JAXB (the reference implementation), EclipseLink MOXy, and JaxMe.

741 questions
14
votes
4 answers

Maven Jaxb2 xjc plugin error No schemas have been found

These days I've spent some time on JAXB for converting XSD to Java Class and vice versa. Here's a very good tutorial for beginners, http://www.journaldev.com/1312/how-to-generate-java-classes-from-xsd-using-xjc-maven-plugin. I follow the steps…
mCY
  • 2,731
  • 7
  • 25
  • 43
14
votes
4 answers

How to write a Unit Test for JAXB 2.0 Marshalling

I am using Jaxb 2.0 api without using XSD, and have created the content model using annotations. I want to write a Junit test for the class which does the marshalling . My original plan was to compare the expected XML String with the actual one…
user1525825
  • 269
  • 1
  • 3
  • 14
13
votes
2 answers

JAXB exception messages: How to change language?

During XML validation against an XSD file using JAXB I get JAXBExceptions in case of invalid XML files. I get the message of the exceptions by calling event.getMessage(). The resulting string is in german language. I'm using JAXB 2.2. with java 8…
waldrabe
  • 303
  • 2
  • 13
12
votes
1 answer

Using JAXB to support schemas with minor variations

The Situation I need to support generating XML documents based on schemas that vary only slightly between each other. Specifically, the schemas that I need to support are based on industry standards that change slightly over time and vendors may…
Terence
  • 706
  • 9
  • 22
12
votes
1 answer

Why does JAXB 2 RI's XJC simple mode change collection names?

JAXB simple binding mode modifies collection names to their plural 'version', e.g. "additionalData" becomes "additionalDatas". Is there any solution to change this behavior? I need to have a Java field name and methods name equal to XSD field name.…
User123456789
  • 121
  • 1
  • 1
  • 3
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
12
votes
2 answers

Nested elements in XSD cause Illegal class inheritance loop exception in JAXB, how can I properly override the bindings?

I have got a problem, I'm trying to bind an XML where there are the name 'Contains' three times. So I read that it's possible to override node names with a binding file. At the moment it doesn't work. I think mistake come from Xpath in the binding…
jt.vervliet
  • 171
  • 1
  • 10
12
votes
2 answers

jaxb2-maven-plugin only executing first execution

I'm trying to convert multiple XSDs to POJOs in different packages using JAXB using the jaxb-maven plugin. I've set it up to use multiple execution blocks, the first execution block executes, then I get a message saying: No changes detected in…
Jan Vladimir Mostert
  • 12,380
  • 15
  • 80
  • 137
12
votes
1 answer

JAXB appending unneeded namespace declarations to tags

I'm implementing a homebrew subprotocol of XMPP, and i'm using combination of StAX and JAXB for parsing/marshalling mesages. And when I marshall a message I end up with loads of unneded namespace declarations:
jb.
  • 23,300
  • 18
  • 98
  • 136
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
11
votes
1 answer

Why CXF / JAXB read whole InputStream into memory before marshalling to SOAP message

INFO - Sample code I've set up sample code (SSCCE) for you to help track the problem: https://github.com/ljader/test-cxf-base64-marshall The problem I'm integrating with 3rd party JAX-WS service, so I cannot change the WSDL. The 3rd party webservice…
ljader
  • 620
  • 2
  • 8
  • 22
11
votes
2 answers

@XmlRegistry - how does it work?

I have found some examples of JAXB2 @XmlRegistry over the internet but no good in-depth tutorials that talk about the concept of using @XmlRegistry with @XmlElementDecl, wonder if its a concept not much explored in general. Anyways here is my…
gresdiplitude
  • 1,665
  • 1
  • 15
  • 27
10
votes
2 answers

Duplicated field in generated XML using JAXB

This is my scenario. I have a generic class: public class Tuple extends ArrayList { //... public Tuple(T ...members) { this(Arrays.asList(members)); } @XmlElementWrapper(name = "tuple") @XmlElement(name = "value") public…
Sergio
  • 8,532
  • 11
  • 52
  • 94
10
votes
3 answers

Skip the Generated on... in Java files using jaxb2 maven plugin

I'd like to get the maven-jaxb2-plugin to do not write the 'disclaimer': This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.2-hudson-jaxb-ri-2.2-63- See
ssedano
  • 8,322
  • 9
  • 60
  • 98
10
votes
2 answers

Using Jaxb2Marshaller with multiple classes having same @XmlRootElement name

I am working on a web service using spring-mvc and Jaxb2Marshaller. I have two classes, both annotated with the same @XmlRootElement name @XmlRootElement(name="request") class Foo extends AstractRequest { } @XmlRootElement(name="request") class…
naiquevin
  • 7,588
  • 12
  • 53
  • 62
1
2
3
49 50