Questions tagged [xjc]

XJC is a JAXB tool for compiling XSD (XML Schema) to Java source code.

XJC is a JAXB tool for compiling XSD (XML Schema) to Java source code.

687 questions
225
votes
16 answers

No @XmlRootElement generated by JAXB

I'm trying to generate Java classes from the FpML (Finanial Products Markup Language) version 4.5. A ton of code is generated, but I cannot use it. Trying to serialize a simple document I get this: javax.xml.bind.MarshalException - with linked…
robinr
  • 4,064
  • 2
  • 18
  • 18
54
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
  • 47,884
  • 23
  • 63
  • 71
45
votes
6 answers

How to generate a Java class which implements Serializable interface from xsd using JAXB?

I would like to introduce caching into an existing Spring project which uses JAXB to expose WebServices. Caching will be done on the level of end points. In order to do that classes generated from XSD using JAXB need to implement Serializable…
Boris Pavlović
  • 58,387
  • 26
  • 115
  • 142
44
votes
4 answers

How to make generated classes contain Javadoc from XML Schema documentation

I'm currently working with an XML Schema that has / on most types and elements. When I generate Java Beans from this XML Schema, then the Javadoc of those Beans only contains some generic generated information…
Joachim Sauer
  • 278,207
  • 54
  • 523
  • 586
41
votes
3 answers

JAXB: How to change XJC-generated classes names when attr type is specified in XSD?

I'm a beginner to JAXB and I'm having annoying issues when generating Java classes with xjc. I am provided with a XSD like this: ...
miguel perher
  • 821
  • 1
  • 7
  • 16
31
votes
8 answers

JAXB XJC Possible to suppress comment creation in generated classes?

Our project uses XJC to generate Java classes from an XSD. I'm using JAVA EE 6. When all the XSDs we have are re-generated, the generated classes include this comment at the top of the file: // Generated on: 2011.02.23 at 02:17:06 PM GMT Is it…
Matt
  • 1,361
  • 3
  • 14
  • 18
29
votes
1 answer

JAXB multiple schemas with element reference

I have two schemas which are processed using JAXB. The first schema is preprocessed and information of this is used using an episode file (following http://www.java.net/blog/2006/09/05/separate-compilation-jaxb-ri-21). The second schema imports the…
Alexander
  • 543
  • 5
  • 9
28
votes
3 answers

What is JAXB generated package-info.java

I'm trying to find some information on what the package-info.java file generated by the JAXB xjc commandline app actually does. All that is in the file is @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.example.com", elementFormDefault…
E-rich
  • 8,247
  • 11
  • 43
  • 71
27
votes
1 answer

JAXB, XJC -> create multiple class files

I'm using JAXB and XJC for first time. I would like to generate Java classes from XML file so I use this online helper to generate schema from XML file. After that I just use this command line to generate Java classes : xjc myschema.xsd it's work…
Olivier J.
  • 2,905
  • 11
  • 40
  • 67
26
votes
2 answers

How to generate @XmlRootElement Classes for Base Types in XSD?

I am having some issues with generating Java Classes with appropriate JAXB annotations from an XSD using XJC. I have a relatively simple XSD file defining my XML schema. The complex types within the XSD take advantage of inheritance using the…
jallch
  • 767
  • 3
  • 8
  • 12
24
votes
3 answers

xjc: Two declarations cause a collision in the ObjectFactory class

Running the following xjc command raises an error : $ xjc "ftp://ftp.ncbi.nih.gov/bioproject/Schema/Core.xsd" parsing a schema... compiling a schema... [ERROR] Two declarations cause a collision in the ObjectFactory class. line 340 of…
Pierre
  • 31,741
  • 29
  • 101
  • 180
21
votes
7 answers

How to generate jaxb classes from xsd using gradle, jaxb and xjc, classes should have XmlRootElement

We were trying to generate JAXB classes using gradle, xsd and xjc, and JAXB classes should have XmlRootElement annotations so it could be used to expose as web service reponse. We were following this link…
Aamir
  • 597
  • 1
  • 4
  • 24
20
votes
1 answer

JAXB XJC code generation - "schemaLocation" missing in xml generated by Marshaller

I Use XJC tool to generate Java classes for my XSD schema. When I use JAXB Marshaller to marshall classes into XML payloads, I'm missing "schemaLocation" parameter in the output XML, but I declare this parameter in xsd file. How to enforce…
cubesoft
  • 3,294
  • 7
  • 44
  • 90
19
votes
6 answers

javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:""). Expected elements are

You can find a lot of questions like this in this site but none has solved my issue. This is my XML :
Rana
  • 505
  • 1
  • 5
  • 19
19
votes
2 answers

How generate XMLElementWrapper annotation with xjc and customized binding

I'm using JAXB and xjc to compile my XML Schema into Java classes. I do not want to manually edit this generated classes. I have xml schema like that:
DEAD10CC
  • 862
  • 6
  • 18
1
2 3
45 46