兩種方法:node
1 <node att="att">text</node>
1 @XStreamAlias("node") 2 @XStreamConverter(value=ToAttributedValueConverter.class, strings={"text"}) 3 public class Node { 4 private String att; 5 private String text; 6 }
1 @XStreamAlias("node") 2 public class Node { 3 @XStreamAsAttribute 4 private String att; 5 private String text; 6 }
第一種適合屬性比節點多的狀況,第二種反之;spa