We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If there is two unwrapped list in sequence in the input xml, the first element of the second list gets its attributes ignored.
Here's a sample input:
<Foo><firstBar id="1"><value>FIRST</value></firstBar> <secondBar id="2"><value>SECOND</value></secondBar></Foo>
Here's a unit test:
@RunWith(JUnit4.class) public class TestXmlBug { static class Foo { @JacksonXmlElementWrapper(useWrapping = false) public List<Bar> firstBar = new ArrayList<Bar>(); @JacksonXmlElementWrapper(useWrapping = false) public List<Bar> secondBar = new ArrayList<Bar>(); } static class Bar { public String value; @JacksonXmlProperty(isAttribute = true) public int id; } @Test public void testName() throws Exception { XmlMapper xmlMapper = new XmlMapper(); Foo foo = new Foo(); Bar bar1 = new Bar(); bar1.id = 1; bar1.value = "FIRST"; foo.firstBar.add(bar1); Bar bar2 = new Bar(); bar2.value = "SECOND"; bar2.id = 2; foo.secondBar.add(bar2); String string = xmlMapper.writeValueAsString(foo); Foo fooRead = xmlMapper.readValue(string, Foo.class); assertEquals(foo.secondBar.get(0).id, fooRead.secondBar.get(0).id); } }
I would have made a regular PR for the unit test but I'm not in my usual workspace and don't have Jackson setup just now.
The text was updated successfully, but these errors were encountered:
Thanks; I can merge in the test case no problem.
Sorry, something went wrong.
Added this as failing test AttributeFailIssue108Test.
AttributeFailIssue108Test
Test for #108
6195a21
Works now, not sure which fix did it, guessing it could be #101.
Sounds like a reasonable guess!
No branches or pull requests
If there is two unwrapped list in sequence in the input xml, the first element of the second list gets its attributes ignored.
Here's a sample input:
Here's a unit test:
I would have made a regular PR for the unit test but I'm not in my usual workspace and don't have Jackson setup just now.
The text was updated successfully, but these errors were encountered: