サンプル XML :
<parent>
<child>1</child>
<child>2</child>
<child>3</child>
</parent>
commons-digester アノテーションを使用して xml を解析しようとしています。xmlの最初の要素のみを取得したい。ただし、反復要素から常に最後の要素を取得します。あなたは私を助けることができます?
サンプルコードは次のとおりです。
@ObjectCreate(pattern = "parent")
public class Parent {
@BeanPropertySetter(pattern = "parent/child")
private String child;
public String getChild() {
return child;
}
public void setChild(String child) {
this.child= child;
}
}