XStream 在 Spring MVC 控制器响应中添加了奇怪的命名空间

发布于 2024-10-27 01:23:59 字数 1076 浏览 6 评论 0原文

有谁知道为什么我要在 XML 节点上为属性“对象”获取命名空间?

它应该只是 JeffF Cross。调试模式下的属性看起来很好,不包含任何额外的数据,并且是一个字符串。这是在 Spring MVC 中使用 Xstream 作为序列化器。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><getMemberActivitiesResponse><validator/><activities><list>

<object xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">JeffF Cross</object>

<validator/><actor>MichaelL FlynnN</actor><actorId>1</actorId><context>Cisco Blogs</context><contextId>1</contextId><dateCreated>3/24/2011 12:00 AM</dateCreated><id>1</id><imageId>9401</imageId><imagePath>http://localhost:8080/Web/resources/assets/users/default.jpgk</imagePath><objectId>54</objectId><verb>is following</verb><verbId>1</verbId></list><total>1</total></activities></getMemberActivitiesResponse>

Does anyone know why I am getting a namespace on an XML node for the property "object"?

It should just be <object>JeffF Cross</object>. The property in debug mode looks like fine and doesn't contain any extra data and is a string. This is in Spring MVC using a Xstream as a serializer.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><getMemberActivitiesResponse><validator/><activities><list>

<object xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">JeffF Cross</object>

<validator/><actor>MichaelL FlynnN</actor><actorId>1</actorId><context>Cisco Blogs</context><contextId>1</contextId><dateCreated>3/24/2011 12:00 AM</dateCreated><id>1</id><imageId>9401</imageId><imagePath>http://localhost:8080/Web/resources/assets/users/default.jpgk</imagePath><objectId>54</objectId><verb>is following</verb><verbId>1</verbId></list><total>1</total></activities></getMemberActivitiesResponse>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白芷 2024-11-03 01:23:59

我通过将属性“object”重命名为“directobject”来修复此问题。看来“object”是XStream无法正确解析的关键字。

I fixed this by renaming the property "object" to "directobject". Seems "object" is a keyword that XStream can't parse correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文