Questions tagged [moxy]

MOXy is the object-to-XML and object-to-JSON component of EclipseLink. It is a JAXB (JSR-222) implementation with extensions for supporting: XPath based mapping, JPA entities, and infoset preservation.

MOXy is the object-to-XML and object-to-JSON component of EclipseLink. It is a JAXB (JSR-222) implementation with extensions for supporting: XPath based mapping, JPA entities, and infoset preservation.

868 questions
9
votes
2 answers

JAXB edit List getter?

I have my data model in the form of XSD files from which I then generate the corresponding Java files from xjc using command line. When I generate JAXB classes from an XSD, List type elements gets a getter method generated for them (with no…
Siddharth Trikha
  • 2,648
  • 8
  • 57
  • 101
9
votes
1 answer

MOXy JAXB: how to exclude elements from marshalling

I have my model: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class CustomerTest { private Long id; @XmlPath("contact-info/billing-address") private AddressTest billingAddress; …
rocotocloc
  • 418
  • 6
  • 19
8
votes
3 answers

My jax-ws webservice client returns only empty objects

I have a third party webservice for which I generate a client using wsimport. Each call to the webservice completes successfully, but the response object I get back has all its fields set to null. Monitoring the network I can see that on the wire…
agnul
  • 12,608
  • 14
  • 63
  • 85
8
votes
4 answers

JAXB 2.x: How to unmarshal an XML without knowing the target class?

If there is a way, how to do this, I'd like to know the most elegant one. Here is the question: - Let's assume you have an abstract class Z - You have two classes inherited from Z: named A and B. You marshal any instance (A or B) like…
basZero
  • 4,129
  • 9
  • 51
  • 89
8
votes
2 answers

JAXB unmarshalling multiple XML elements into single class

I have the following XML structure, which is modelling a single concept across multiple XML elements. This format is not in my control. 1 x
andyb
  • 43,435
  • 12
  • 121
  • 150
8
votes
1 answer

Deserializing JSON with Jersey and MOXy into a List collection

I'm trying to take JSON objects and put them into a collection (I picked List). I've been able to unmarshal the JSON responses into single POJOs by creating BuiltCharacter with the appropriate getters and setters. For an array of JSON elements, I…
iresprite
  • 181
  • 5
8
votes
1 answer

JAXB for lists to be returned naturally for JSON or XML

I'm using MOXy with Jersey to implement a RESTful API and want to return lists naturally for JSON and XML, by which I mean that the XML contains an element tag for the overall collection as well as the collection items, whereas the JSON contains a…
Scott
  • 345
  • 4
  • 8
8
votes
1 answer

Jaxb Inheritance using Substitution but not to root Element

I was going through the Blaise's Blog http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-using-substitution.html for Jaxb Inheritance using Substitution. I want to implement the same but not to the root element. I am looking this type of XML as a…
kwatra
  • 85
  • 1
  • 7
8
votes
1 answer

JAXB @XmlAdapter: Map -> List adapter? (marshall only)

I have a Map. The first idea everyone has is to convert it to a List> (Pair being a custom class). I've tried a @XmlAdapter like this: public class MapPropertiesAdapter extends XmlAdapter,…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
7
votes
1 answer

EclipseLink MOXy @XmlPath support for axes/parent

Are any of the following XPath expressions acceptable? Using version 2.3.1 of eclipselink @XmlPath("../header/@type") @XmlPath("/root/header/@type") @XmlPath("parent::*/header/@type") Basically this is in a class which repeats within the XML…
mikeapr4
  • 2,830
  • 16
  • 24
7
votes
3 answers

Cannot get EclipseLink MOXy to work

I'm new to JAXB and I want to change the default namespace prefix using EclipseLink MOXy. My package-info.java has the following code lines: @javax.xml.bind.annotation.XmlSchema ( namespace="http://namespace.mysite.com/", xmlns = { …
Khutsi
  • 73
  • 1
  • 1
  • 6
7
votes
2 answers

HTTP Put Enum using JAX-RS REST-Service

I am facing problems in an Jax-RS REST-Service when trying to update an entity containing enumerations via HTTP PUT. I am putting the entity encoded as JSON, so the enumerations I am using in this JSON are delivered as strings. I am getting…
EsSuch
  • 79
  • 4
7
votes
1 answer

Does MOXy support non-string @XmlID in version 2.6.0?

According to https://gist.github.com/VineetReynolds/5108580, JAXB Spec requires element annotated with @XmlID to be a String. This hasn't been enforced by MOXy in versions 2.5.x. With version 2.6.0, however, it seems it's not supported…
Stepan Vavra
  • 3,884
  • 5
  • 29
  • 40
7
votes
3 answers

How to remove xmlns:xsi and xsi:type from JAXB marshalled XML file

I've got a set of JAXB generated classes and some of the classes have setter methods which accepts "Object" as the parameter. For example: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name="Car", propOrder = { "defaultCar" } public class Car…
user3572079
  • 135
  • 1
  • 2
  • 12
7
votes
1 answer

MOXy deserialization exception: A descriptor with default root element was not found in the project

Here are my classes: @XmlRootElement(name="Zoo") class Zoo { //@XmlElementRef public Collection animals; } @XmlAccessorType(XmlAccessType.FIELD) @XmlSeeAlso({Bird.class, Cat.class,…
Behzad Pirvali
  • 764
  • 3
  • 10
  • 28
1
2
3
57 58