JAXB eclipse error: There's no JAXB 2.2 API in the classpath
Tag : java , By : user86493
Date : March 29 2020, 07:55 AM
|
Eclipse PDE headless build fails with: failed to create task or type eclipse.generateFeature
Date : March 29 2020, 07:55 AM
like below fixes the issue I found the solution in the discussion here: It is important to run the Ant script of the build within the same JRE as the workspace because otherwise the PDE Ant tasks cannot be found: Right click on the Ant script (build.xml) > Run As > Ant Build … > JRE tab of the wizard > switch to option: 'Run in the same JRE as the workspace'
|
How to create nested Root Element in JAXB when creating xml from Java object using JAXB
Date : March 29 2020, 07:55 AM
it fixes the issue You didn't say which problem you have with your code. But I observed these things; You need the @XmlRootElement only on your root element, i.e. on class Automobiles, but not on the others. @XmlElement
public List<Bike> getBikes() { ... }
@XmlElement(name = "bike")
public List<Bike> getBikes() { ... }
@XmlElement
public List<Bike> getBike() { ... }
|
Validating xml against xsd file generated through JAXB and XSD build option in eclipse
Tag : java , By : nd27182
Date : March 29 2020, 07:55 AM
I hope this helps you . The generated code is on github for you. I'm gussing that it's a problem with the xml or xsd files -- but I don't know for a fact. thufir@dur:~/xml/so$
thufir@dur:~/xml/so$ ls
foo.xml
thufir@dur:~/xml/so$
thufir@dur:~/xml/so$ cat foo.xml
<MLIspec>
<id>4050response</id>
<typename>4050Response</typename>
<description>Show the Contract Numbers</description>
<element>
<id>7504</id>
<name>SourceAccountIdentifier</name>
<type>table</type>
<required>true</required>
</element>
</MLIspec>
thufir@dur:~/xml/so$
thufir@dur:~/xml/so$ trang foo.xml foo.xsd
thufir@dur:~/xml/so$
thufir@dur:~/xml/so$ cat foo.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="MLIspec">
<xs:complexType>
<xs:sequence>
<xs:element ref="id"/>
<xs:element ref="typename"/>
<xs:element ref="description"/>
<xs:element ref="element"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="typename" type="xs:NMTOKEN"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="element">
<xs:complexType>
<xs:sequence>
<xs:element ref="id"/>
<xs:element ref="name"/>
<xs:element ref="type"/>
<xs:element ref="required"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name" type="xs:NCName"/>
<xs:element name="type" type="xs:NCName"/>
<xs:element name="required" type="xs:boolean"/>
<xs:element name="id" type="xs:NMTOKEN"/>
</xs:schema>
thufir@dur:~/xml/so$
thufir@dur:~/xml/so$ xjc foo.xsd
parsing a schema...
compiling a schema...
generated/Element.java
generated/MLIspec.java
generated/ObjectFactory.java
thufir@dur:~/xml/so$
thufir@dur:~/xml/so$ tree
.
├── foo.xml
├── foo.xsd
└── generated
├── Element.java
├── MLIspec.java
└── ObjectFactory.java
1 directory, 5 files
thufir@dur:~/xml/so$
thufir@dur:~/NetBeansProjects$
thufir@dur:~/NetBeansProjects$ cat /home/thufir/xml/output.xml
cat: /home/thufir/xml/output.xml: No such file or directory
thufir@dur:~/NetBeansProjects$
thufir@dur:~/NetBeansProjects$ git clone git@github.com:THUFIR/xjc_generated-code.git
Cloning into 'xjc_generated-code'...
remote: Enumerating objects: 143, done.
remote: Counting objects: 100% (143/143), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 143 (delta 25), reused 120 (delta 11), pack-reused 0
Receiving objects: 100% (143/143), 79.43 KiB | 191.00 KiB/s, done.
Resolving deltas: 100% (25/25), done.
thufir@dur:~/NetBeansProjects$
thufir@dur:~/NetBeansProjects$ cd xjc_generated-code/
thufir@dur:~/NetBeansProjects/xjc_generated-code$
thufir@dur:~/NetBeansProjects/xjc_generated-code$ gradle clean run
> Task :run
Jan 17, 2019 2:34:06 PM xjc_generated.code.driver.App unmarshallMLI
INFO: generated.MLIspec@12edcd21
BUILD SUCCESSFUL in 1s
4 actionable tasks: 3 executed, 1 up-to-date
thufir@dur:~/NetBeansProjects/xjc_generated-code$
thufir@dur:~/NetBeansProjects/xjc_generated-code$ cat /home/thufir/xml/output.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MLIspec>
<id>4050response</id>
<typename>4050Response</typename>
<description>Show the Contract Numbers</description>
<element>
<id>7504</id>
<name>SourceAccountIdentifier</name>
<type>table</type>
<required>true</required>
</element>
</MLIspec>
thufir@dur:~/NetBeansProjects/xjc_generated-code$
|
cvc-complex-type.3.2.2: Attribute 'jaxb:extensionBindingPrefixes' is not allowed to appear in element 'jaxb:bindings'
Date : March 29 2020, 07:55 AM
|