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.

733 questions
19
votes
1 answer

JAXB maven plugin not generating classes

I am trying to generate the java files from the XSD, but the below code doesn't generate. If I uncomment outputDirectory, it works but delete the folder first. adding clearOutputDir = false is also not generating anything.
krmanish007
  • 6,749
  • 16
  • 58
  • 100
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
1 answer

How to write an external binding file for xjc?

The documentation of JAXB xjc says: -b Specify one or more external binding files to process. (Each binding file must have it's own "-b" switch.) The syntax of the external binding files is extremely flexible. You may have a single binding…
tangens
  • 39,095
  • 19
  • 120
  • 139
19
votes
4 answers

JAXB compiler is binding xs:boolean to Java Boolean wrapper class, instead of boolean primitive type

I'm migrating a project from JAXB 1.0 to JAXB 2.1 and I'm having problems with the datatype mapping. I'm using the Ant xjc binding compiler, and I've successfully configured the global bindings such that (for example) xs:date maps to…
mdarwin
  • 1,684
  • 7
  • 28
  • 72
19
votes
8 answers

How do I get xjc?

So I've been looking at interfacing with xml files for a project I've been working on, and one of the things I want to do is generate java classes from a .dtd file. After some searching, I found out that xjc should be able to do what I want, but I…
Ross Aiken
  • 912
  • 1
  • 6
  • 16
17
votes
2 answers

Create a common xsd generated class to be used by other packages

I am trying to use the same generated class but in separate packages. So the structure should look something like this: com.test.common -commonType.java com.test.A -objectA.java com.test.B -objectB.java But i keep getting…
Matt
  • 2,803
  • 9
  • 33
  • 57
17
votes
5 answers

JAXB binding file: XmlAdapters and package name

I have a binding file like this
Puce
  • 37,247
  • 13
  • 80
  • 152
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
17
votes
4 answers

JAXB: How to generate English Javadoc

When I generate JAXB classes using the maven-jaxb2-plugin I get classes with partial(!?) German Javadoc. (My default locale: de_CH) What I want: English Javadoc I tried to set the maven opts: -Duser.language=en -Duser.country=US but it had no…
Puce
  • 37,247
  • 13
  • 80
  • 152
17
votes
4 answers

Applying external JAXB binding file to schema elements imported from WSDL

The XPath expression in my external binding files can't target the elements in my XML schemas which are imported into my WSDL. Everything runs if I do inline binding customization but I really wanted to have external binding files that way I never…
Chase
  • 3,123
  • 1
  • 30
  • 35
16
votes
1 answer

JAXB XJC - XPath evaluation results in empty target node?

I've got the following simple XSD document (foo.xsd):
maerics
  • 151,642
  • 46
  • 269
  • 291
16
votes
2 answers

Resolving type definitions from imported schema in XJC fails

I've got this API using JAXB to conveniently use object models, generated from XML Schemas by the XJC (XML-to-Java) compiler, through named references. It abstracts the creation of JAXB contexts and finding ObjectFactory methods away by all sorts of…
G_H
  • 11,739
  • 3
  • 38
  • 82
15
votes
4 answers

java.lang.ClassNotFoundException: com.sun.codemodel.CodeWriter with JDK9

[WARNING] The POM for org.glassfish.jaxb:jaxb-runtime:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details [WARNING] The POM for org.glassfish.jaxb:jaxb-xjc:jar:2.2.11 is invalid,…
rathna
  • 1,055
  • 2
  • 11
  • 23
14
votes
5 answers

JAXB / XJC parent-child-parent navigation

i would like to have bidirectional navigation methods in classes between child object and parent object. IDREF is not enough in my case because I don't want to specify le id of parent. to be clear, from an xsd like that:
fedevo
  • 631
  • 1
  • 7
  • 15
14
votes
3 answers

JAXB XJC compiler disregarding mixed=true on XML Schema documents

XJC seems to be completely ignoring mixed="true" on my XML Schema elements thereby not allowing me to extract text content. From the sample XML below, I need to be able to extract "Title Text." Without mixed="true" being recognized, no accessor is…
Kaleb Pederson
  • 45,767
  • 19
  • 102
  • 147
1
2
3
48 49