XStream 在 Spring MVC 控制器响应中添加了奇怪的命名空间
有谁知道为什么我要在 XML 节点上为属性“对象”获取命名空间?
它应该只是 。调试模式下的属性看起来很好,不包含任何额外的数据,并且是一个字符串。这是在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过将属性“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.