
| Key: |
XSTR-283
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Assignee: |
Unassigned
|
| Reporter: |
Joerg Schaible
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
XStream
Created: 07/Mar/06 04:02 PM
Updated: 31/Jul/06 05:29 PM
|
|
| Component/s: |
None
|
| Affects Version/s: |
None
|
| Fix Version/s: |
1.2
|
|
|
Issue Links:
|
Related
|
|
This issue relates to:
|
|
XSTR-276
Implicite Collections lead to duplicate id attribute in XML
|
|
|
|
|
|
|
|
|
If the implicit collection should be referenced, XStream cannot build a valid reference:
static class WithNamedList extends WithList {
private final String name;
public WithNamedList(final String name) {
this.name = name;
}
}
public void testReferenceByXPathWorksWithReferencedImplicitCollection() {
xstream.alias("strings", WithNamedList.class);
xstream.addImplicitCollection(WithNamedList.class, "things");
WithNamedList[] wls = new WithNamedList[]{new WithNamedList("foo"), new WithNamedList("bar")};
wls[0].things.add("Hello");
wls[0].things.add("Daniel");
wls[1].things = wls[0].things;
String xml = xstream.toXml(wls);
System.out.println(xml);
}
<strings-array>
<strings>
<name>foo</name>
<string>Hello</string>
<string>Daniel</string>
</strings>
<strings>
<name>bar</name> reference="../strings"
</strings>
</strings-array>
|
|
Description
|
If the implicit collection should be referenced, XStream cannot build a valid reference:
static class WithNamedList extends WithList {
private final String name;
public WithNamedList(final String name) {
this.name = name;
}
}
public void testReferenceByXPathWorksWithReferencedImplicitCollection() {
xstream.alias("strings", WithNamedList.class);
xstream.addImplicitCollection(WithNamedList.class, "things");
WithNamedList[] wls = new WithNamedList[]{new WithNamedList("foo"), new WithNamedList("bar")};
wls[0].things.add("Hello");
wls[0].things.add("Daniel");
wls[1].things = wls[0].things;
String xml = xstream.toXml(wls);
System.out.println(xml);
}
<strings-array>
<strings>
<name>foo</name>
<string>Hello</string>
<string>Daniel</string>
</strings>
<strings>
<name>bar</name> reference="../strings"
</strings>
</strings-array>
|
Show » |
|