私は Java で XML 読み取りの例を探していましたが、典型的なスキーマのルート -> 3 つの等しい息子 -> 3 つの等しい孫を常に見つけます。
しかし、書籍{タイトル、著者、ページ数}を含むライブラリのように保存されていない要素のペアを取得する必要がある場合があります。私のXMLは次のようになります:
<?xml version="1.0" encoding="UTF-8" ?>
<A>
<Crap1>
<CrapSon>1</CrapSon>
</Crap1>
<B>
<Crap2>Store</Crap2>
<C>
<Type>N</Type>
<D>
<InterestingData1>Data</InterestingData1>
</D>
<InterestingData2>More Data</InterestingData2>
</C>
</B>
</A>
もちろん、すべてを反復して、最終的に目的のデータ要素に到達することもできます。しかし、ツリーを繰り返し処理せずに、必要な要素にアクセスする高速な方法はありますか? 名前だけで検索させますか?