3 Replies Latest reply: Jul 18, 2011 10:46 AM by 716599 RSS

    JAXB mapping of field to sub nodes

      I have the following XML I consume:

                <node2 expirationDate="10/10/2012" />

      And the following Java class:

      @XmlRootElement(name= "root")
      class Foo
      private String expirationDate;

      My question is whether it is possible to map the expirationDate field member DIRECTLY to a <node2> value/attribute. Perhaps something like:


      Currently, the only way I can think about doing it is by having another class I'll map for node1 and another class for node2 and have the first class have a field member of the second class.