xjc

XJC Java class generation for <xs:choice> element which is not unbounded

懵懂的女人 提交于 2019-12-06 14:12:41
After this similar question yesterday I have another question concerning inheritance in XML schema and XJC bindings. Given the following choice element such that Book and Journal have a common parent type ( Publication ). <xsd:choice > <xsd:element name="Book" type="Book" /> <xsd:element name="Journal" type="Journal" /> </xsd:choice> The Java class properties which are generated are like: private Book book; private Journal journal; Since <xsd:choice> means that there might be either a Book or a Journal I would prefer private Publication bookOrJournal; If I had a list of Publications by setting

How to have Java classes generated from WSDL implement an interface

我的未来我决定 提交于 2019-12-06 06:10:13
Our main wsdl has a series of wsdl imports. Each sub-wsdl imports common.xsd and defines the request and reply objects for a particular operation. I want the request objects in each of the sub-wsdl documents to implement a common interface. First, I tried using xsd:extension and extracted the common elements to a base class. This works, but changes the publicly exposed wsdl and I don't want to do that. It has been stable and unchanged for a while now. This change should be completely transparent to consumers of the web services. I found this: http://confluence.highsource.org/display/J2B

Intellij IDEA doesn't recognized XJC task attributes

不打扰是莪最后的温柔 提交于 2019-12-06 03:18:35
I have an ant build.xml file with XJC task definition: <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"> <classpath> <fileset dir="jaxb" includes="*.jar" /> </classpath> </taskdef> jaxb dir cotnains jaxb-xjc.jar with XJCTask class inside. Then I call xjc task in some target: <target name="mytarget"> <xjc target="src" package="com.p1.Person" header="false"> <schema dir="src/com/p1" includes="Person.xsd"/> </xjc> </target> Intellij IDEA doesn't recognize the structure/schema of the xjc call and highlights all attributes (target, package, header) and containing elements (schema) in red.

How do I rename top level Classname during JAXB code generation using XJC?

杀马特。学长 韩版系。学妹 提交于 2019-12-06 00:17:20
I am trying to generate some beans from several xsd's. Unfortunately they all have the same root element. I have successfully created a xjc bindings file for renaming sub-elements but cannot find a way to select the root node to change that. I tried the following but get the error: [ERROR] XPath evaluation of "/" needs to result in an element. <jxb:bindings version="1.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:com.fnf="http://www.fnf.com/xes"> <jxb:bindings schemaLocation="transcode-submit.xsd

marshall with xjc created nested classes

老子叫甜甜 提交于 2019-12-05 23:36:00
问题 <ProductInformation Context="GL"> <Assets> <Asset ID="assetID" UserTypeID="ID"> <Name>name</Name> <Reference ClassificationID="id"/> <Values> <Value AttributeID="ID">Value1</Value> <Value AttributeID="ID">Value2</Value> <MultiValue AttributeID="attributeID"> <Value>value3a</Value> <Value>value3b</Value> </MultiValue> </Values> </Asset> </Assets> <Products>....</Products> </ProductInformation> I used this xml->xsd and xjc to create classes from it. Now I want to create my ProductInformation

Selecting nodes with XPath for binding a subset of classes with JAXB

自闭症网瘾萝莉.ら 提交于 2019-12-05 18:08:52
问题 Simplified Question: What's the XPath to select all XML nodes with an attribute that ends with the string "Notification". The first and third nodes in this snippet: <events> <event name="CreatedNotification" /> <event name="InfoLog" /> <event name="UpdatedNotification" /> </events> Detailed Question: I want to select multiple complexTypes from a xsd schema for binding with JAXB. This works for a single class: OrderStateChangeNotification <jxb:bindings schemaLocation="apiv2.xsd"> <jxb:bindings

JAXB maven plugin not generating classes

妖精的绣舞 提交于 2019-12-05 16:38:54
问题 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. <build> <plugins> <!-- JAXB xjc plugin that invokes the xjc compiler to compile XML schema into Java classes.--> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution>

XmlAdapter not working correctly with newer version of JAXB

≯℡__Kan透↙ 提交于 2019-12-05 12:13:15
I'm executing a Maven Project with the below source package com.coderplus.jaxb; import java.util.HashMap; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @XmlJavaTypeAdapter(PropertiesMapAdapter.class) public class PropertiesMap<K,V> extends HashMap<String,String> { } .. package com.coderplus.jaxb; import java.util.Map.Entry; import javax.xml.bind.annotation.adapters.XmlAdapter; public class PropertiesMapAdapter extends XmlAdapter<Properties, PropertiesMap<String, String>> { @Override public PropertiesMap<String, String> unmarshal(Properties properties) throws Exception {

xjc, maven-jaxb2-plugin: cryptic java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()

浪尽此生 提交于 2019-12-05 10:23:28
I'm attempting to use maven-jaxb2-plugin to compile the XSDs at http://www.aptatcip.com/APTA-TCIP-S-01%204.0_files/Schema%20Set.zip Using this pom.xml , and the command line below (run from the parent folder), the compilation fails with a fairly cryptic error message (also given below): pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>onebusaway-nyc</artifactId> <groupId>org

JAXB XJC code generation of element initializers with their declaration

做~自己de王妃 提交于 2019-12-05 04:27:37
If I have a schema such as the following: <xs:element name="Book"> <xs:complexType> <xs:sequence> <xs:element ref="Chapter" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Chapter"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Word" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Word"> </xs:element> It will generate something like: @XmlRootElement(name = "Book") public class Book { @XmlElement(name = "Chapter", required = true) protected Chapter chapter; Is it possible to generate the following instead? @XmlElement(name =