jaxb

I want to convert an output stream into String object

I want to convert an output stream into String object . I am having an outputstream object returned after marshalling the jaxb object. ...

Java marshaller performance

Hi, I've used JAXB Marshaller as well as my own marshaller for marshalling pure java bean objects into XML. It has been observed that both of them require almost same time to marshal. The performance is not acceptable and needs to be improved. What are possible ways where we can improve performance of marshaller? Like threading? ...

JAXB - Beans to XSD or XSD to beans?

I have an existing data model. I would like to express this data model in terms of XML. It looks like I have two options if I'm to use JAXB: Create an XSD that mirrors my data model, and use xjc to create binding objects. Marshalling and unmarshalling will involve creating a "mapping" class that would take my existing data objects a...

Validating against a Schema with JAXB

I've been looking for solutions to this problem for far too long considering how easy it sounds so I've come for some help. I have an XML Schema which I have used with xjc to create my JAXB binding. This works fine when the XML is well formed. Unfortunately it also doesn't complain when the XML is not well formed. I cannot figure out...

xsd:datetime and XmlGregorianCalendar causes NullPointerException

The following works: public Date getDate() { return date; } and produces something like: <date>2010-03-23T17:43:50.879Z</date> And I can use an XmlGregorianCalendar to return xsd:date or xsd:time types fine: @XmlSchemaType(name="date") public XmlGregorianCalendar getDate() { return date; } which produces something like: ...

JAXB is throwing an exception saying the property "retainReferenceToInfo" is invalid

Mysteriously, JAXB is throwing a JAXBException that says that some property "retainReferenceToInfo" is invalid. No where in my code does this appear, what's going on? ...

jaxb unmarshal timestamp

I cannot get JAXB to unmarshal a timestamp in a Resteasy JAX-RS server application. My class looks like this: @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name = "foo") public final class Foo { // Other fields omitted @XmlElement(name = "timestamp", required = true) protected Date timestamp; public Foo() {} ...

How to generate several versions of Java classes generated by JAXB ?

Hello, I recently generate two versions of Java classes generated by JAXB. So I get two packages : V1_0 and V2_0 I notice that I have only one ObjectFactory generated. The problem is that this ObjectFactory is specific to a version (here it's specific to my version v1_0). So the question is : Could I configure JAXB to allow to make on...

PHP JAXB Equivalent

Is there a PHP equivalent to JAXB? It's proved very useful for Java development, and as a new PHP'er I'd like to use the same concepts JAXB provides in a PHP world. ...

Unexpected JAXB error

Hello, From the documentation it's clear I need to use the following to get a simple unmarshalling to occur from my XML file/schema: JAXBContext jc = JAXBContext.newInstance("PackageName"); where PackageName is my package name. I've looked on google for a bit to no avail, to find out why I'm then getting this runtime error: Line:C...

JAXB: @XmlTransient on third-party or external super class

Hi, I need some help regarding the following issue with JAXB 2.1. Sample: I've created a SpecialPerson class that extends a abstract class Person. Now I want to transform my object structure into a XML schema using JAXB. Thereby I don't want the Person XML type to appear in my XML schema to keep the schema simple. Instead I want the f...

Hyperjaxb @Entity

How to avoid declaring fully qualified name of the derived class in @Entity annotation? I have the following xsd: <xsd:complexType name="Project"> <xsd:annotation> <!-- ... --> </xsd:annotation> <xsd:sequence> <!-- ... --> </xsd:sequence> </xsd:complexType> but it generates the following java source...

JAXB Annotated class - setting of a variable which is not an element

I have a JAXB annotated class say @XmlRootElement(namespace = "http://www.abc.com/customer") Class Customer{ @XmlElement(namespace = "http://www.abc.com/customer") private String Name; @XmlElement(namespace = "http://www.abc.com/customer") private String Address; @XmlTransient private HashSet set = new HashSet(); public S...

Java/XML: Good "Stream-based" Alternative to JAXB?

Hello Experts, JAXB makes working with XML so much easier, but I have currently a big problem, that the documents I have to process are too large for an in memory unmarshalling that JAXB does. The data can be up to 4GB per document. The datastructure I will have to process is very simple and flat: With a root element and millions of “...

How do I prevent JAXB from generating Java from imported schema?

I've got two Java projects, both generate Java classes based on a schema definition, I'm using xjc to create the classes. My second project depends on a class from the first project, and in particular, one of the classes I'd like to generate in my second project needs to use one of the types from the first project. To accomplish this d...

NullPointerException in com.sun.tools.jxc.SchemaGenTask

Given this ant script: <?xml version="1.0" encoding="UTF-8"?> <project name="projectname" default="generate-schema" basedir="."> <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask"> <classpath> <fileset dir="../BuildJars/lib" includes="*.jar" /> </classpath> </taskdef> <target ...

Can JAXB Incrementally Marshall An Object?

I've got a fairly simple, but potentially large structure to serialize. Basically the structure of the XML will be: <simple_wrapper> <main_object_type> <sub_objects> </main_object_type> ... main_object_type repeats up to 5,000 times </simple_wrapper> The main_object_type can have a significant amount of data. On my f...

how can i unmarshall in jaxb and enjoy the schema validation without using an explicit schema file

I am using jaxb for my application configurations I feel like I am doing something really crooked and I am looking for a way to not need an actual file or this transaction. As you can see in code I: 1.create a schema into a file from my JaxbContext (from my class annotation actually) 2.set this schema file in order to allow true vali...

how can I write a schema that produce an unordered xml with extension

In the following schema I am trying to make an unordered xml that extends simpleConfigurationObject: <xs:complexType name="forTestingConfigurationObjectCreator"> <xs:complexContent> <xs:extension base="simpleConfigurationObject"> <xs:all> <xs:element name="a" type="xs:string"/> <xs:element name="b" type="xs:s...

JAX-WS MarshalException with custom JAX-B bindings: Unable to marshal type "java.lang.String" as an element because it is missing an @XmlRootElement annotation

I seem to be having an issue with Jax-WS and Jax-b playing nicely together. I need to consume a web-service, which has a predefined WSDL. When executing the generated client I am receiving the following error: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.SAXException2: u...