jaxb

JAXB annotations for groovy attribute classes

have a project set up like the following: import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @XmlRootEle...

JAXB supress XSI and xmlns

I am using JAXB to marshall some groovy objects. I am getting output like this: <desiredskillslist> <employeeDesiredSkills xsi:type="employeeDesiredSkill" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; <name>C Development</name> </employeeDesiredSkills> <employeeDesiredSkills xsi:type="employeeDesiredSkill" xmlns:xsi=...

Jaxb2Marshaller and attributes

I have a problem using Jaxb2Marshaller for unmarshalling XML attributes (of primitive types). Here is the sample: <?xml version="1.0" encoding="UTF-8"?> <request xmlns="..."> <items> <item id="1"/> <item id="2"/> <item id="3"/> </items> </request> And the entity class is: @XmlAccessorType(XmlAccessType...

How can I tell Jersey to use my MessageBodyReader instead using JAXB?

Basically, I have some models which all use JAXB. However, I have some highly custom functionality to convert to JSON and back so I want to write my own MessageBodyReader/Writer to do the job for me. Right now, the writing portion is done: if i return one of my models from a REST resource, it goes through my writer. But when I try and a...

Jersey @Provider not recognized

We are using a Jersey JAXBContext resolver implementation using @Provider. It appears that Jersey is not recognizing the @Provider class - the code is never being executed. Is there a reason that Jersey/JBoss isn't properly identifying the class? ...

Jersey JSON marshalling of empty lists

We have a Java List of objects which is marshalled via JSON which is created by Jersey. The List is called "rows". When there is data we have: {"records":"1","page":"1","total":"1","rows":[{"id":"692334","cell":["ECS","D","201009","","0","ABCD","11","11","","201009"]}]} When there is no data we have: {"page":0,"records":0,"total":...

jersey webservice returns a 415 when executing a PUT from Ext.Ajax.request

Hey all, So, I've got a pretty simple RESTful jersey webservice, and I'm wanting to call it from my javascript code. I have no problem executing a GET request, but for some reason, when I execute a PUT, I get back a "415 Unsupported Media Type" error. Any idea what I'm doing wrong? Here's my webservice : package servlet; import jav...

JAXB XmlJavaTypeAdapter Map from List : pros/cons of this design pattern

Hi, I have written a JAXB mapping that stored a sublist inside a root element in a LinkedHashMap<String, Object> instead of a Collection<Object> maintained through a specific XmlJavaTypeAdapter. Hereunder a sample: @XmlRootElement public class Parent { @XmlJavaTypeAdapter(ListToMapAdapter.class) @XmlElement private LinkedHa...

JAXB, xs:any and targetNamespace

I have an XSD that defines the following schema: <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://example.com/2010/aa/" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:aa="http://example.com/2010/aa/" targetNamespace="...

Is there a JavaScript API for XML binding - analog to JAXB for Java?

In Java, we work a lot with JAXB2. Object<->XML mappings are defined as annotations in Java classes: @XmlRootElement(name="usertask", namespace="urn:test") public class UserTask { @XmlElement(namespace="urn:test") public String getAssignee() { ... } public void setAssignee(String assignee) { ... } } JAXB runtime can read ...

Using JAXB to pass subclass instances as superclass

What I have is a set of Java classes (close to 25) representing message types. They all inherit from a Message class which I'd like to be abstract. Each message type adds a few additional fields to the set provided by the Message superclass. I'm implementing some RESTful web services using RESTeasy and would like to have methods like ...

Can you add comments to a "jaxb.index" file?

Has anybody found any documentation on comments in jaxb.index files? I've searched the web, but couldn't find any information. Using "# comment" style lines does work, but is this actually specified anywhere? Thanks for your help. ...

SAAJ compatibility with JAXB

I've been working on creating a SAAJ based client. Everything seemed to be working fine, until I implemented the logic to send attachments as part of a web-service request. The web-service operation is simple - it expects a string element for file-location, and a base64binary element for the file content. I've tested the ws operation u...

JAXB :: Validation of XML during Unmarshalling

Hello All, JAXB Generated classes only capture the structural information from the XML schema that is used to generate the classes, but they ignore any additional constraints on the data e.g allowed set of values(enumerations), max value allowed etc. Does it mean that if i do not have a schema i can only validate structural information a...

why does HTTPClient response produce JSON stream, when the same GET request in the browser shows XML response?

Hi, I am using HttpClient for the first time to make a request to a web service (defined by WADL), I'd like to unmarshall the response into a meaningful object, in the browser if I perform the Get request it response with XML. But when I display the response from the code it seems to be JSON. Am I missing a step? or is there a way th...

Using EclipseLink MOXy with Java 1.5

Has anyone got EclipseLink MOXy (I'm using eclipselink 2.1.0) to work with Java 5? Whenever I try to unmarshal I get a null pointer exception in org.eclipse.persistence.oxm.record.UnmarshalRecord, in the startCDATA() method (xPathNode is null). The exact same code and XML works wonderfully in Java6. ...

How to generate java code from xsd using jaxb and not allowing the user to use the xml attribute

Hey all, I'm using JAXB to generate java code from xsd. I want to generate attribute (Java code) that cannot be used in the xml. For example: <xs:complexType name="Button"> <xs:attribute type="xs:string" name="ribbonGroup"> </xs:complexType> I want to see the getter and setter of the attribute ribbonGroup in th...

Marshal a field/property to an xml-element with an additional xml-attribute name=propertyName

Hi everyone, I have a java object like: public class Person { private String firstName = "Harry"; private String lastName = "Hacker"; private int age = 30; } which I would like to marshal into the following xml: <attribute xsi:type="someType" name="Person"> <attribute xsi:type="CustomStringType" name="firstName"> <v...

JAX RS Jersey Schema Validation

How to configure schema validation for JAX-RS RESTFul services? We are using XSD to define the models, and JAXB to generate the java models. ...

Jaxb2 : create seperate directorie per namespace

Hi, im using maven-jaxb2-plugin to generate from a 1.0xsd file: <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <executions> <execution> <id>generate-modelesV1.0</id> <goals> <goal>generate</goal> </goals> <configuration> <schem...