現在、XStream を使用して XML ファイルを解析していますが、必要な処理を行うことができません。この問題を解決できるものなら何でも、必要に応じて別のライブラリに変更します!
基本的に、次のような XML フィードを解析しようとしています。
<product>
<title>Transformers Best of Grimlock</title>
<author1>Bob Budiansky</author1>
<author2>Simon Furman</author2>
</product>
私は次のようなモデルに解析しようとしています:
public class Product extends Model {
public String title;
public List<String> authors;
}
タイトルは美しく機能しますが、著者の解析に苦労しています。残念ながら、次のような「より適切な」形式で XML フィードを取得することはできません。
...
<authors>
<author>Bob Budiansky</author>
<author>Simon Furman</author>
</authors>
...
「author1」、「author2」などをリストに解析するためにできることはありますか?
私は XStream に非常に慣れていない (そして JAXB をまったく使用したことがない!) ので、カスタム バインダーなどを作成する必要がある場合は、どこから始めればよいかについてのポインターが必要になることを覚えておいてください。
読んでくれてありがとう、正気を保つ可能性のある解決策を楽しみにしています! :)
編集: XStream に縛られていないことを示すために投稿を更新しました。これに対する答えを見つけるのに本当に苦労しています - おそらく私は何を検索すればよいのかわからないだけです...