2015-05-28 54 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,如果你要放弃庞大的数据,只需要导航到一个数据。