2015-05-28 55 views
0

後,我已經從一個肥皂web服務的響應後,我解組應答我有類似這樣的對象層次響應:篩選結果和解組響應

products 
result 1 price=12 
collection_method_1 
from=1 to=3  
result 2 price=14 
collection_method_1 
from=1 to=3 
result 3 price=15 
collection_method_2 
from=2 to=5 
result 4 price=16 
collection_method_2 
from=1 to=5  
result 5 price=17 
collection_method_2 
from=1 to=2 
result 6 price=18 
collection_method_2 
from=1 to=4 
result 7 price=19 
collection_method_2 
from=2 to=3 
result 8 price=21 
collection_method_2 
from=3 to=4 
result 9 price=22 
collection_method_2 
from=4 to=5 
legend 
locations 
location 1 text="" 
location 2 text="" 
location 3 text="" 
location 4 text="" 
location 5 text="" 
location 6 text="" 
locations 
collection_methods 
collection_method_1 text="" 
collection_method_2 text="" 
collection_methods 
legend 
products 

這是在Java中的最佳方式, JAXB ...(或任何其他技術)從圖例中指定要從響應中刪除的位置X,刪除包含此位置的所有結果?請注意,位置在響應中用「from」和「to」引用。 有什麼建議嗎?

感謝

問候

回答

1

使用SOAP最好的辦法是使用一些XSLT將返回的消息轉換成你需要的格式。

很少有更多的選擇 1:使用JAXB輸出轉換爲某種收集和使用 2.使用SAX而不是JAXB,如果你要放棄龐大的數據,只需要導航到一個數據。