users@jaxb.java.net

RE: How to marshal hexBinary correctly?

From: Ernst, Matthias <matthias.ernst_at_coremedia.com>
Date: Tue, 31 Jul 2007 17:02:57 +0200

Jervis,

> However in my case, I do not have any Java type classes,
> thus there is no way to have an annotation.

Then what kind of output do you expect? A string? Then
It's no XML and you can just use:

  new HexBinaryAdapter().marshal(arg);

Otherwise, you need a class where you can annotate the hexbinary child/attribute.

public class Bytes {
  @XmlValue @XmlJavaTypeAdapter(HexBinaryAdapter.class) public byte[] value;
}

Matthias
-- 
matthias.ernst_at_coremedia.com
software architect
+49.40.32 55 87.503
CoreMedia AG
Executive Board: Sören Stamer (CEO), Dr. Klemens Kleiminger (CFO)
Supervisory Board: Prof. Dr. Joachim Schmidt (Chairman)
Trade Register: Amtsgericht Hamburg, HR B 76277