xjc

XSD sequence compile to different lists

人走茶凉 提交于 2020-01-15 12:33:05
问题 I have XSD schema like this: <xs:complexType name="Element" abstract="true"> <xs:sequence maxOccurs="unbounded"> <xs:element name="resistor" type="vs:Resistor" maxOccurs="unbounded"/> <xs:element name="capacitor" type="vs:Capacitor" maxOccurs="unbounded"/> <xs:element name="inductor" type="vs:Inductor" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> And when I process this schema through JAXB I get a field like this: @XmlElements({ @XmlElement(name = "resistor", required = true, type

XSD sequence compile to different lists

主宰稳场 提交于 2020-01-15 12:32:21
问题 I have XSD schema like this: <xs:complexType name="Element" abstract="true"> <xs:sequence maxOccurs="unbounded"> <xs:element name="resistor" type="vs:Resistor" maxOccurs="unbounded"/> <xs:element name="capacitor" type="vs:Capacitor" maxOccurs="unbounded"/> <xs:element name="inductor" type="vs:Inductor" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> And when I process this schema through JAXB I get a field like this: @XmlElements({ @XmlElement(name = "resistor", required = true, type

Import namespace - Cannot resolve the name to a(n) 'type definition' component

房东的猫 提交于 2020-01-15 01:19:46
问题 Context: I am generating java classes from xsd files using maven-jaxb plugin. All my .xsd files are in a single location - src/main/resource directory. Problem: Everything works fine when xsd's don't reference/import other xsd's with a different target namespace. However when the following xsd below (with targetNamespace="http://www.companyA.com/someservice") imports another xsd filename.xsd from a different namespace (namespace="http://www.companyB.com/"), I get the above error: Cannot

Import namespace - Cannot resolve the name to a(n) 'type definition' component

痴心易碎 提交于 2020-01-15 01:19:18
问题 Context: I am generating java classes from xsd files using maven-jaxb plugin. All my .xsd files are in a single location - src/main/resource directory. Problem: Everything works fine when xsd's don't reference/import other xsd's with a different target namespace. However when the following xsd below (with targetNamespace="http://www.companyA.com/someservice") imports another xsd filename.xsd from a different namespace (namespace="http://www.companyB.com/"), I get the above error: Cannot

JAXB empty node in bindings

半腔热情 提交于 2020-01-14 10:40:52
问题 JAXB can't parse the bindings for this example: <xs:element name="classA" type="classA" substitutionGroup="classSubA"/> <xs:complexType name="complexClassA" mixed="true"> <xs:attribute name="attA"> <xs:annotation> <xs:appinfo> <moProperty value="classA:attA"/> <label value="Attribute A" default="true"/> <externAccess value="readWrite"/> <description value="NO COMMENTS"/> </xs:appinfo> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="off"/> <xs

JAXB 2.1 - Customize xs:any binding

孤人 提交于 2020-01-10 19:29:55
问题 I want to generate java code from xsd using JAXB 2.1 XJC. I have an xsd schema provided and I can't change it. I would like to use xjc:simple mode while generating java classes from xml schema. In the xsd there are elements: <xs:any namespace="##other" processContents="lax"/> As it is stated here: http://jaxb.java.net/guide/Mapping_of__xs_any___.html I expected that these elements will be binded to: @XmlAnyElement(lax=true) public Object any; but when I use simple binding mode xjc:simple I

How to make generated classes contain Javadoc from XML Schema documentation

我只是一个虾纸丫 提交于 2020-01-09 04:38:05
问题 I'm currently working with an XML Schema that has <xsd:annotation> / <xsd:documentation> 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 about the allowed content of the type/element. I'd like to see the content of the <xsd:documentation> tag in the relevant places (for example the content of that tag for a complextType should show up in the Javadoc of the class generated to represent

JAXB Make QName in Objectfactory accessible

风格不统一 提交于 2020-01-04 06:10:58
问题 When you generate java classes with JAXB you'll always get a Class named ObjectFactory. In this class there is a private attribute QName with the namespace in it. Is it possible to tell the generator to make this attribute accessible from the outside. So maybe make it public or create a getter for it? 回答1: I believe those private static QName fields are only generated if the ObjectFactory needs methods that create JAXBElement<...> instances. If you call one of those methods to get a

XSD for XMI 2.1.1

余生颓废 提交于 2020-01-04 05:13:45
问题 I have to parse a XMI file (xmi version 2.1.1) using JAXB. For that, I have to generate Java classes corresponding to a XMI file. So I need a shema definition of a xmi file to do that with the jxc tool. I hope anyone know where I can find this file. Thanks in advance for help ! Edit : for more informations, there is an exemple of a xmi file (generated using modelio) : <?xml version="1.0" encoding="UTF-8"?> <uml:Model xmlns:uml="http://schema.omg.org/spec/UML/2.1.1" xmlns:xmi="http://schema

Override the JAXB property name using a xjb preserving the underscores

。_饼干妹妹 提交于 2020-01-03 10:27:23
问题 The custom xjb works great for overriding the names as desired however we lose the underscores in the names. <?xml version="1.0" encoding="UTF-8"?> <jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1"> <jxb:globalBindings underscoreBinding="asCharInWord"/> <jxb:bindings schemaLocation="foo.xsd"> <jxb:bindings node="//xs:complexType[@name='fooType']"> <jxb:property name="value" /> </jxb:bindings> </jxb:bindings> </jxb:bindings> As