Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367795 - Chained @XmlValue properties not working correctly
Summary: Chained @XmlValue properties not working correctly
Status: CLOSED DUPLICATE of bug 368283
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-03 16:12 EST by Blaise Doughan CLA
Modified: 2022-06-09 10:21 EDT (History)
1 user (show)

See Also:


Attachments
MOXy - Test Cases (9.61 KB, patch)
2012-01-03 16:17 EST, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (7.24 KB, patch)
2012-01-03 16:17 EST, Blaise Doughan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blaise Doughan CLA 2012-01-03 16:12:53 EST
Issue sent in via email:

In the RI, the output element has the value of the inner text.  In MOXy I get a rather strange output:

<top><middle><text()>Some Value</text()></middle></top>

When I’m expecting

<top><middle>Some Value</middle></top>

In this case I have the following three classes:

@XmlRootElement
public class Top {

  @XmlElement
  public Middle middle;

  public String toString() {
    return "Top(" + middle + ")";
  }

}

public class Middle {

  @XmlValue
  public Bottom bottom;

  public String toString() {
    return "Middle(" + bottom + ")";
  }

}

public class Bottom {

  @XmlValue
  public String value;

  public String toString() {
    return "Bottom(" + value + ")";
  }

}

And the following testing harness:

    JAXBContext c = JAXBContext.newInstance(Top.class);
    System.err.println(c.getClass());
    Marshaller m = c.createMarshaller();

    Top t = new Top();
    t.middle = new Middle();
    t.middle.bottom = new Bottom();
    t.middle.bottom.value = "Some Value";

    FileOutputStream out = new FileOutputStream("c:\\temp\\t.xml");
    m.marshal(t, out);
    out.close();

    Unmarshaller u = c.createUnmarshaller();
    Top tu = (Top) u.unmarshal(new File("c:\\temp\\t.xml"));
    System.err.println(tu);
Comment 1 Blaise Doughan CLA 2012-01-03 16:17:24 EST
Created attachment 208964 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2012-01-03 16:17:59 EST
Created attachment 208965 [details]
Core - Fix
Comment 3 Blaise Doughan CLA 2012-01-10 13:17:06 EST

*** This bug has been marked as a duplicate of bug 368283 ***
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:21:27 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink