2
@XmlRootElement(name = "FNOL")
@XmlAccessorType(XmlAccessType.FIELD)
public class ConversationXML {
@XmlElementWrapper(name = "ParticipantList")
@XmlElement(name = "Participant")
List<ParticipantsXML> participantList;
@XmlElement
KeyActionsXML keyActions;
@XmlElement
LossDetailsXML lossDetails;
@XmlElement
AdditionalLossDetailsXML addLossDetails;
@XmlElement
PolicyDetailsXML policyDetails;
//getter setter
}
此代碼,我要的屬性添加到ParticipantList元素
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FNOL>
<ParticipantList>
<Participant inv="" v="" pid="" id=""/>
</ParticipantList>
<keyActions inv="" v="" pid="" id="11"/>
<lossDetails inv="" v="" pid="" id="11"/>
<addLossDetails inv="" v="" pid="" id="11"/>
<policyDetails inv="" v="" pid="" id="11"/>
</FNOL>
像這樣的,但我不知道該怎麼做。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FNOL>
<ParticipantList inv="" v="" pid="" id="">
<Participant inv="" v="" pid="" id=""/>
</ParticipantList>
<keyActions inv="" v="" pid="" id="11"/>
<lossDetails inv="" v="" pid="" id="11"/>
<addLossDetails inv="" v="" pid="" id="11"/>
<policyDetails inv="" v="" pid="" id="11"/>
</FNOL>
有人可以幫我這一個:)