【发布时间】:2011-09-15 06:21:36
【问题描述】:
我有一个来自网络服务的 xml 响应:
<ns2:response xmlns:ns2="http://abc.com">
<ns2:msgHeader>
<ns2:empid>1234</ns2:empid>
<ns2:empname>John</ns2:empid>
</ns2:msgHeader>
<error>
<httpstatus>500</httpstatus>
<description>Error while processing the request.Please contact customercare</description>
</error>
</ns2:response>
当 xml 架构采用这种格式时,我如何解组。 <error> 是根元素 <response> 的一部分。
我正在使用 Restful 客户端并使用 resttemplate 向服务器发出请求。我的 applicationcontext.xml 使用 org.springframework.http.converter.xml.MarshallingHttpMessageConverter 编组和解组请求和响应 XML。
【问题讨论】:
标签: java xml spring namespaces unmarshalling