2
我有下面的XML代表一個調用事件並需要解組到Java對象。我正在使用JAXB並且能夠處理大部分內容,除了表示值集合的塊作爲元素名稱。在JAXB中表示多個元素名稱
爲每個可能的元素創建一個類的缺點(即給出here)有沒有一種方法可以更動態地在JAXB中表示它?
<message xmlns='jabber:client' from='pubsub.server.example.com' to='[email protected]'
id='[email protected]__uz8mQ'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='leon_office_vmstsp_default'>
<item id='leon_office_vmstsp_default'>
<callstatus xmlns='http://xmpp.org/protocol/openlink:01:00:00#call-status'
busy='false'>
<call>
<id>1411743786867</id>
<profile>leon_office</profile>
<interest>leon_office_vmstsp_default</interest>
<changed>State</changed>
<state>CallEstablished</state>
<direction>Outgoing</direction>
<duration>3</duration>
<caller>
<number>6001</number>
<name>leon_office</name>
</caller>
<called>
<number>3807</number>
<name>3807</name>
</called>
<actions>
<ClearCall />
<RemoveThirdParty />
<StopVoiceDrop />
<MuteParty />
<AddThirdParty />
<SendDigit />
<ClearConnection />
<UnMuteParty />
<StartVoiceDrop />
</actions>
<participants>
<participant exten='3807' />
<participant exten='6001' />
</participants>
<features>
<feature id='Conference'>true</feature>
</features>
</call>
</callstatus>
</item>
</items>
</event>
<headers xmlns='http://jabber.org/protocol/shim'>
<header name='pubsub#subid'>aLfatHpG059mNcAe5ta11YNOAjA02l486sE1p4hK</header>
</headers>
你解決了這個問題嗎?如果是的話,你是如何解決它的? – Xstian 2014-10-13 13:52:07