Java XSTREAM阵列转换器

Java XSTREAM阵列转换器,java,xml,xstream,Java,Xml,Xstream,我想将下面的XML转换为对象。我 <authentication> <name>Reese Rideout</name> <shows type="array"> <show>stage</show> <show>youtube</show> </shows> </authentication> 里斯·里迪奥特 阶段

我想将下面的XML转换为对象。我

<authentication>
    <name>Reese Rideout</name>
    <shows type="array">
        <show>stage</show>
        <show>youtube</show>
    </shows>
</authentication>

里斯·里迪奥特
阶段
youtube
我有一个带有列表显示的身份验证类。我相信我将需要使用阵列转换器。然而,我不知道如何使用它,也没有找到任何文件

请建议如何将其解析为我的对象图。

 <authentication>
      <name>Reese Rideout</name>
      <shows type="array">
         <show>stage</show>
         <show>youtube</show>
       </shows>
    </authenticatoin>

我就是这样解决的:

xstream.alias("shows", Shows.class);
xstream.alias("show", String.class);

并将
Shows.Shows
字段设置为隐式集合:
xstream.addImplicitCollection(Shows.class,“Shows”)

@Jinesh它可以是,但是从您提供的XML中,不需要将它作为对象,字符串将为您完成不起作用的操作。我正在配置的别名是xstream.aliasField(“show”,show.class,“show”);com.thoughtworks.xstream.converters.ConversionException:show:show----调试信息----消息:show:show我不完全理解您的答案。你能像Jigar Joshi那样提供更多细节吗?使用.addImplicitCollection的上下文是什么?
xstream.alias("authentication", Authentication.class);
xstream.alias("Show", Show.class);
xstream.alias("shows", Shows.class);
xstream.alias("show", String.class);