moxy

MOXY- Multiple XSDs import the same schema definition- error: 'element' is already defined

自作多情 提交于 2019-12-24 09:27:59
问题 I have 3 XSDs linked together: schema1.xsd imports namespace="x:y:z" schemaLocation= "schemaDefinitions.xsd" includes schema2.xsd schema2.xsd imports namespace="x:y:z" schemaLocation= "schemaDefinitions.xsd" includes schema3.xsd schema3.xsd imports namespace="x:y:z" schemaLocation= "schemaDefinitions.xsd" These xsds are provided by an outside source and cannot be changed. Previously my project used standard JAXB with classes created at compile time. I currently am switching to Dynamic JAXB

JAXB-ElipseLink: @XmlJavaTypeAdapter and the type-attribute

爷,独闯天下 提交于 2019-12-24 07:28:29
问题 I am using @XmlJavaTypeAdapter to marshal fields of type Map to XML. This results in EclipseLink-MOXy creating an xsi:type="<myValueType>" -attribute on the output xml-element. Upon validation the referenced type can of course not be found. Is there any way of suppressing the generation of this attribute? PS: An XmlAdapter-tag would be handy :) 回答1: Turns out the type-attribute had nothing to do with the @XmlJavaTypeAdapter annotation. It was caused by the fact, that the Map's elements were

JAXB-Eclipselink: Inherited properties

情到浓时终转凉″ 提交于 2019-12-24 06:47:38
问题 I have following use-case for marshalling a POJO to XML using Eclipselink MOXy 2.3: public abstract class A { public abstract getX(); } public class B extends A { private Foo x; @Override public Foo getX() { return this.x; } } public class C extends B { // Various fields and properties here } I need to marshal B and C but not A. So i set A to be transient which makes B inherit all its members that will be marshalled when marshalling B. I cant set B to be transient since i need to marshal it

How to have multiple sections with the same name in JAXB?

别等时光非礼了梦想. 提交于 2019-12-24 06:37:48
问题 I am using EclipseLink Moxy as my JAXB provider and presently facing issues in getting the XML marshalled in an expected fashion. I presently have an object which is having multiple objects. Object 1 having @XmlElement(name="Section") Object2 @XmlElement(name="Section") Object3 I want to get the XML rendered as: <Object1> <Section> <Object2>... </Section> <Section> </Object3>... </Section> </Object1> I am using Moxy but I am not able to get the desired result. I tried creating a list of

standalone value does not appear in xml generated by moxy - jaxb

£可爱£侵袭症+ 提交于 2019-12-24 03:52:33
问题 I have a xml file generated using moxy implementation of jaxb. However standalone value does not appear in the xml document. 回答1: Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group. The standalone attribute is seldom used, and is only relevant if you are using a DTD. Since JAXB (JSR-222) is primarily used with XML Schema it doesn't apply. We chose not to output that attribute in the MOXy implemenation of JAXB (JSR-222). Other XML technologies chose not

Mapping XML to Java object that doesn't match XML structure

不羁岁月 提交于 2019-12-24 03:37:11
问题 I get a flat XML document from a call to a legacy system and I would like to be able to unmarshal it into multiple Java objects (ideally) using annotations. There is no xsd with the XML and I want to maintain the current structure of my Java classes because they map to the structure of the JSON I am returning from my restful service. I have seen examples of this problem in reverse using MOXy, but no examples of this problem exactly. So given ... <xml> <body> <a>A</a> <b>B</b> <c>C</c> <d>D</d

Marshal empty lists as absent nodes with JAXB

删除回忆录丶 提交于 2019-12-24 01:14:46
问题 Using JAXB I would like to have the possibility to marshal empty lists as absent nodes. I think that EclipseLink MOXy has that possibility, but I can't get it to work. According to: http://wiki.eclipse.org/User:Rick.barkhouse.oracle.com/Test1 you should be able to do it like this: @XmlElementWrapper(name="line-items", nillable=true) @XmlNullPolicy(shouldMarshalEmptyCollections=false) List<LineItem> item = null; But shouldMarshalEmptyCollections is not a valid property. I've tried using

is it possible with JAXB to marshal two or more elements into one domain object field?

懵懂的女人 提交于 2019-12-23 20:26:27
问题 I have two different XML structures I'd like to map to one domain object. I'm using MOXy's external binding support so I can choose which binding to use dynamically. Here's my question. I have an XML structure like the one below: <entity> <compoundID_one>foo</compoundID_one> <compoundID_two>bar</compoundID_two> </entity> I'd like to have a single List<String> field in my domain class which would contain 'foo' and 'bar' I've tried this: ... <java-attributes> <xml-elements> <xml-element java

Unmarshal a single element list fails

柔情痞子 提交于 2019-12-23 18:09:51
问题 I'm running a sample (which i can't find anymore) from Blaise Doughans blog on Glassfish 3 using EclipseLink 2.5 MOXy for JAXB service. @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Company { @XmlElementWrapper(name="employees") @XmlElement(name = "employee", type=Employee.class) private List<Employee> employees; } @XmlAccessorType(XmlAccessType.FIELD) public class Employee { private String id; private String name; } I added some annotations to the classes, to produce the

eclipselink + @convert(json) + postgres + list property

折月煮酒 提交于 2019-12-23 11:58:22
问题 I'm using eclipselink 2.6 as a persistence provider of spring data jpa, that in my understanding, now allows you to serialize a subtree of an entity as json using the internal moxy serializer. So I'm trying to mix this to migrate from embedded element collections to a serialized json using the json datatype of postgres. I have an entity named Product, and this entity have the following mapped property: @Convert(Convert.JSON) private List<MetadataIndex> indexes=new ArrayList<MetadataIndex> ();