I have the following XML file
<?xml version="1.0"?>
<paths>
<path action="M">some/path</path>
<path action="D">another/path</path>
</paths>
I am trying to read it using the following classes:
public class Paths {
@XStreamImplicit(itemFieldName="path")
private ArrayList<Path> paths;
}
@XStreamAlia开发者_如何学运维s("path")
public class Path {
String path;
@XStreamAsAttribute
private String action;
}
The value of 'action' (Path.action) is really stored. But I only get NULL for the Path.path variable.
Any ideas of what I might have done wrong?
try ToAttributedValueConverter:
@XStreamAlias("path")
@XStreamConverter(value=ToAttributedValueConverter.class, strings={"path"})
public class Path {
String path;
String action;
}
精彩评论