jaxb

How to generate classes from XSD that implements serializable?

I need to generate many classes from my XML Schema (XSD) in a package (.jar). How can I configure these classes to be serializable? (I'm using Eclipse and JAX-B) ...

Simple conversion between java.util.Date and XMLGregorianCalendar

I'm looking for a simple method of converting between java.util.Date and javax.xml.datatype.XMLGregorianCalendar in both directions. Here is the code that I'm using now: import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.X...

GXT with JAXB classes

I am trying to create a user interface which contains an Editable grid which contains data from XSD file. I have generated the required classes from the XSD file using XJC. But I cant figure out how to load the data into the grid using methods of the JAXB generated classes. Can anyone please tell me how to go about doing this? I have imp...

spring jaxb exception

hi. my code: <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="mediaTypes"> <map> <entry key="xml" value="#{subscribersXml.contentType}" /> </map> </property> <property name="order" value="0"/> </bean> <bean id="subscribersXml" class="org.springfram...

JAXB: How to unmarshall objects in lists?

Perhaps a stupid question: i have a List of type <Data> which i want to unmarshall into a XML file. This is my class Database containing an ArrayList... @XmlRootElement public class Database { List<Data> records = new ArrayList<Data>(); public List<Data> getRecords() { return records; } public void s...

hyperjaxb3 xsd:string length in JPA entity

Hi guys, I use Hyperjaxb3 to generate JPA entities from XSD schema. I have a xsd:string type that I want to use for description text (text area in the UI): <xsd:complexType name="Description"> <xsd:simpleContent> <xsd:extension base="**xsd:string**"> <xsd:attribute name="abc" type="xsd:NCName" use="optional" /> ...

Java objects to XML using javax.xml.bind.annotations

Hello, If I have an object that contains a few fields that are Lists of other objects, and I want to generate the XML to represent that object, I get something like this <top level object> <object1 /> <object1 /> <object1 /> <object2 /> <object2 /> <object3 /> </top level object> and I want to generate something like thi...

Spring MVC: Adding JAXB to the classpath so that it automatically serializes XML

According to Spring MVC documentation, <mvc:annotation-driven/> configures support for JSON if Jackson is in the classpath, and support for XML if JAXB is present in the classpath. Simply by adding a Jackson dependency to my pom.xml, I get JSON support to work! (see: Ajax Simplification in Spring 3.0) However, after trying to access the...

How to make an "Exception" type class consumed by jaxb-xjc Throwable?

Is there a way to make a class generated by jaxb-xjc Throwable? I haven't found a way to do it in the binding file. If a schema defines an "Exception" type is there some other way to use it as such? Google results seem to be drowned in other Exceptions and Throwables. ...

JAXB + Enums + Showing Multiple Values

I have an enum: @XmlEnum @XmlRootElement public enum Product { POKER("favourite-product-poker"), SPORTSBOOK("favourite-product-casino"), CASINO("favourite-product-sportsbook"), SKILL_GAMES("favourite-product-skill-games"); private static final String COULD_NOT_FIND_PRODUCT = "Could not find product: "; private...

parsing subnodes with Jersey

We are connecting to a third party using Jersey. We then want to extract the returned xml into our class. This is actually working fine except for one node in the xml that is in a subnode. Here is the xml returned: <response> ... <langISO>en</langISO> <acquirerAmount>1000</acquirerAmount> <acquirerCurrency>GBP</acquirerCurrency> <subXml>...

JAXB Make QName in Objectfactory accessible

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? ...

A java.lang.ClassCastException while accessing web service method written in java. jaxb

Hi All, I am writing an application where i have to interact with MS SQL database. In my application i am creating web services (using javax.jws) for accessing database tables. i am creating one operation(method) in web service with return type java.lang.Object[][] as follows : @WebMethod(operationName = "get_HistoryInfoByUser") publi...

JAXB - Can XJC compile appinfo into the class structure?

I have a schema which is read by a few different applications for form generation; one of them uses JAXB/XJC to compile its class structure. The schema contains appinfo information for friendly names of fields, eg: <xs:element name="HomeAddress" type="xs:string"> <xs:annotation> <xs:appinfo>Home address</xs:appinfo> </xs:annotat...

Ignore a parent class when Serializing to XML

Is there a JAXB annotation to ignore a parent class, when you have an @XmlElement on a List of the child classes? Just to clarify - I was wondering if there was a better way than marking all of the parent classes getters/setters as transient, and then having to go back to the child classes and add getters/setters and annotating those as...

@XmlRootElement and <T extends Serializable> throws IllegalAnnotationExceptions

When I marshall an instance of this class ... @XmlRootElement public static class TestSomething<T extends Serializable> { T id; public T getId() { return id; } public void setId(T id) { this.id = id; } } ... the following Exception is thrown ... com.sun.xml.bind.v2.runtime.IllegalAnnotationsExce...

get String length in StringWriter?

I'm using JAXB, I need to know the length of generated XML, so I marshal the content to StringWriter, so which way is better to get the length: aStringWriter.getBuffer().length(); or aStringWriter.toString().length(); ? ...

org.springframework.oxm.jaxb.Jaxb2Marshaller umlauts and special characters

How can I marshal java string object that contain umlauts by using org.springframework.oxm.jaxb.Jaxb2Marshaller ? I have java string like Alizée. After marshalling with using Jaxb2Marshaller i get Alizée xml string. ...

@XmlSeeAlso with more than one parameter

http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSeeAlso.html According to this, I should be able to make my root element have more than one class reference. However, when I try that, I get this exception: [groovyc] Compiling 72 source files to C:\Users\dcole\.grails\1.3.4\projects\trunk\classes [groovyc] org.c...

How can I get Spring to properly marshal XML value into a Java date?

I'm using Spring 3 to create some ReST services. When POSTing XML, Spring handles String fields but won't convert Date fields. Here is an example: @XmlRootElement(name = "TestObj") @XmlAccessorType(XmlAccessType.FIELD) public class TestObj { @XmlElement(type = Date.class, name = "Birthdate") @XmlJavaTypeAdapter(BirthdateXmlAda...