I want to show java-objects data in JSON and XML views using Spring. I got it but with the XML view I got the following message precedingdata: "XML file does not appear to have any style information". I don't know how to fix/remove that message, I think that it's something related with the xml headers... But I don't know how to modify the header with spring, I am returning the object with @ResponseBody in the controller.
我想使用Spring在JSON和XML视图中显示java-objects数据。我得到了它但是在XML视图中我得到了以下消息:“XML文件似乎没有任何样式信息”。我不知道如何修复/删除该消息,我认为它与xml标题有关...但我不知道如何用spring修改标题,我在@ResponseBody中返回对象控制器。
Controller:
@RequestMapping(value = "/funding/{uuid}.xml")
@ResponseStatus(HttpStatus.OK)
public @ResponseBody PatrocinadorResource getPersistentIdentifierXML(
@PathVariable(value = "uuid") String uuid) {
PatrocinadorResource fResult = new PatrocinadorResource(....);
return fResult;
}
Output: (can't post images)
输出:(无法发布图片)
XML file does not appear to have any style information
<funding id="0">
<contact/>
<identification/>
<name>Nombre 0</name>
<signature>Firma 0</signature>
<surnames>Apellido 0</surnames>
<uuid>550e8400-e29b-41d4-a716-446655440000</uuid>
</funding>
Any idea?
1 个解决方案
#1
0
The message
XML file does not appear to have any style information
XML文件似乎没有任何样式信息
is just a warning from the browser that it doesn't know how to display it, because the XML doesn't specify a stylesheet. You can ignore it - it is not actually part of your response XML. Other applications calling your service will just see this:
只是来自浏览器的警告,它不知道如何显示它,因为XML没有指定样式表。您可以忽略它 - 它实际上不是您的响应XML的一部分。其他调用您服务的应用程序只会看到:
<?xml version="1.0" encoding="UTF-8" ?>
<funding id="0">
<contact/>
<identification/>
<name>Nombre 0</name>
<signature>Firma 0</signature>
<surnames>Apellido 0</surnames>
<uuid>550e8400-e29b-41d4-a716-446655440000</uuid>
</funding>
Note the first line (it might look a bit different) which indicates that this is an XML message. Your browser won't show it.
注意第一行(可能看起来有点不同),表明这是一条XML消息。您的浏览器不会显示它。
#1
0
The message
XML file does not appear to have any style information
XML文件似乎没有任何样式信息
is just a warning from the browser that it doesn't know how to display it, because the XML doesn't specify a stylesheet. You can ignore it - it is not actually part of your response XML. Other applications calling your service will just see this:
只是来自浏览器的警告,它不知道如何显示它,因为XML没有指定样式表。您可以忽略它 - 它实际上不是您的响应XML的一部分。其他调用您服务的应用程序只会看到:
<?xml version="1.0" encoding="UTF-8" ?>
<funding id="0">
<contact/>
<identification/>
<name>Nombre 0</name>
<signature>Firma 0</signature>
<surnames>Apellido 0</surnames>
<uuid>550e8400-e29b-41d4-a716-446655440000</uuid>
</funding>
Note the first line (it might look a bit different) which indicates that this is an XML message. Your browser won't show it.
注意第一行(可能看起来有点不同),表明这是一条XML消息。您的浏览器不会显示它。