jaxb
  1. jaxb
  2. JAXB-819

No values in JAXBElement wrapped class

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: runtime
    • Labels:
      None
    • Environment:

      Mac OS X 10.5

      Description

      I have generated my java classes using this command:

      xjc -d ./src jaxb_problem.xsd

      Everything compiles. Nice!. Here's a part of my xsd in problem (in xsd_problem.txt attached)

      Here's the generated *EN* class:

      ....
      @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType(name = "EN", propOrder = {
      "content"
      })
      @XmlSeeAlso({
      ON.class,
      PN.class,
      TN.class
      })
      public class EN {

      @XmlElementRefs(

      { @XmlElementRef(name = "delimiter", namespace = "urn:hl7-org:v3", type = JAXBElement.class), @XmlElementRef(name = "validTime", namespace = "urn:hl7-org:v3", type = JAXBElement.class), @XmlElementRef(name = "suffix", namespace = "urn:hl7-org:v3", type = JAXBElement.class), @XmlElementRef(name = "prefix", namespace = "urn:hl7-org:v3", type = JAXBElement.class), @XmlElementRef(name = "family", namespace = "urn:hl7-org:v3", type = JAXBElement.class), @XmlElementRef(name = "given", namespace = "urn:hl7-org:v3", type = JAXBElement.class) }

      )
      @XmlMixed
      protected List content;
      ......

      Here's the java code doing the unmarshalling in problem:

      ...
      for (Serializable s :
      pPersonName.getValue().getContent()) {
      if (s instanceof String)

      { System.out.print((String) s); }

      else {
      String tag = ((JAXBElement)
      s).getName().getLocalPart();
      if (s instanceof EnFamily)

      { EnFamily chunk = (EnFamily) ((JAXBElement) s).getValue(); System.out.print("(" + tag + ":"); }


      }
      }
      ...

      And here's my problem: The class *EnFamily* extracted from a
      JAXBElement does not contain any values. It should contain "Smith". It
      seems it is not unmarshalling correctly.

      See the xsd and xml files attached.

      1. jaxb_problem.xsd
        2 kB
        erick.audet
      2. prob.xml
        0.3 kB
        erick.audet

        Activity

        Hide
        Martin Grebac added a comment -

        Would you please attach a full testcase? I'm having troubles reproducing what you describe. Thanks.

        Show
        Martin Grebac added a comment - Would you please attach a full testcase? I'm having troubles reproducing what you describe. Thanks.
        Hide
        rahulsom added a comment -

        Related to JAXB-837

        Show
        rahulsom added a comment - Related to JAXB-837

          People

          • Assignee:
            Martin Grebac
            Reporter:
            erick.audet
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: