I am trying to write some extensible XML code which logically
maps to the following java interface:
public interface Event {
String getType();
String getVersion();
String getContent();
}
I intend the XML to look something like the following:
<event type="myEvent" version="1.0">
<myEventElement>hello</myEventElement>
</event>
Having done this, my implementation of this interface should be
able to return "myEvent" for getType(), "1.0" for getVersion()
and "<myEventElement>hello</myEventElement>" for getContent().
This would of course be easy, if I was happy with:
<event type="myEvent" version="1.0">
<myEventElement>hello</myEventElement>
</event>
But I'm not. I guess I could do the <event> bit myself with
some SAX code, and then use JAXB for the <myEventElement> stuff,
but if possible I'd like to be able to do all of it in JAXB.
I'm not sure if this makes any sense to anybody, but any ideas
about how to solve this problem would be much appreciated.
Thanks
Marcus