Details
-
Type: Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
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[]
;
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>
Issue Links
- relates to
-
XSTR-276 Implicite Collections lead to duplicate id attribute in XML
A HierarchicalStreamWriter cannot reference a non-existing element. Both issues lack of this (obvious) incapability. We must find a general workaround for referenced implicit collections.