Xstream在输出中插入奇怪的标签(Xstream inserts strange tags in output)

编程入门 行业动态 更新时间:2024-10-07 20:30:35
Xstream在输出中插入奇怪的标签(Xstream inserts strange tags in output)

我有一个XML处理应用程序(用java编码),它应该采用2个JavaNcss工具报告并编译它们的差异。

示例XML如下:

<objects> <object> <name>Object Name</name> <ncss>8</ncss> <functions>2</functions> <classes>0</classes> <javadocs>2</javadocs> </object> </objects>

虽然应用程序本身工作正常,但我注意到输出中包含以下标记:

<object reference="../object[18]"/> <object reference="../object[41]"/> <object reference="../object[10]"/> <object reference="../object[41]"/> <object reference="../object[12]"/> <object reference="../object[41]"/> <object reference="../object[14]"/>

我不知道造成这种麻烦的原因。 任何帮助将不胜感激。 提前致谢。

I have an XML Processing Application ( coded in java) that is supposed to take 2 reports of JavaNcss tool and compile their diff.

The sample XML is as follows :

<objects> <object> <name>Object Name</name> <ncss>8</ncss> <functions>2</functions> <classes>0</classes> <javadocs>2</javadocs> </object> </objects>

While the application itself is working accurately , I noticed the inclusion of the following tags in the output :

<object reference="../object[18]"/> <object reference="../object[41]"/> <object reference="../object[10]"/> <object reference="../object[41]"/> <object reference="../object[12]"/> <object reference="../object[41]"/> <object reference="../object[14]"/>

I have no clue as to what is causing this trouble. Any help would be greatly appreciated. Thanks in advance.

最满意答案

这里的XStream解释http://x-stream.github.io/graphs.html 。

如果它找到重复的对象,那么它使用引用来引用前面的引用。 这是默认行为。

如果你不想,那就去做xstream.setMode(XStream.NO_REFERENCES);

XStream explanation here http://x-stream.github.io/graphs.html.

If it finds duplicate object then it uses the reference to refer to the earlier one. This is the default behavior.

If you do not want then do this xstream.setMode(XStream.NO_REFERENCES);

更多推荐

本文发布于:2023-07-27 04:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1284875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:奇怪   标签   Xstream   inserts   output

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!