Skip to main content

generateElementClass binding customisation

2 replies [Last post]
sdp198
Offline
Joined: 2005-04-06

I've been trying to ensure that all of the elements defined in my schema lead to a class being generated. At present an element like this in the schema:

Binary data encoded as Base64, 3 bytes in 4 characters, format

gets turned into a java property like this:
@XmlElement(name = "Base64Data", namespace = "http://www.dvb.org/tm-tam-pcf/pcf-types")
protected byte[] base64Data;

Ideally I'd like to generate a class called base64Data which then contains something like byte[] value. I don't really want to have to customise this on a per element basis as there are quite a few, so I was wondering if setting generateElementClass in the globalbindings would do this?

I have tried it, but I'm getting swamped by error messages saying that anonymous complexType definitions are causing name clashes (they all get called TypeType) in the generated Java code. I was a bit surprised, because I thought these complexTypes would be nested within the Java class containing the element which they are within?

Cheers,

Stephen

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09

I think placing customization on that element declaration would guarantee that that element will become its own class.

The name collision around TypeType sounds like a bug. Please file an issue to http://jaxb.dev.java.net/

sdp198
Offline
Joined: 2005-04-06

Thanks - I've tried adding jaxb:Class and that works for me.

I've filed an issue now.