我有一个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);
更多推荐
发布评论