たとえば、私はそのようなxmlファイルを持っています:
<?xml version="1.0"?>
<catalog>
<title>My book catalog</title>
<link>http://example.com/catalog</link>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
</catalog>
最後に、オブジェクトを取得する必要があります。これは次のように使用できます。
xml.title //must return "My book catalog"
xml.link //must return "http://example.com/catalog"
xml.book[0] //is an object with following properties:
//author, title, genre etc...
//i.e., xml.book[0].author must return Gambardella, Matthew
同様の質問がなかったことを願っています。私が見つけられなかったことがあれば申し訳ありません。また、この特定のケースに関するドキュメントがある場合は、それを指摘してください。私はそれを見つけることができませんでした。さまざまな方法でのxml解析に関するドキュメントはたくさんありましたが、この場合の情報はありません。
前もって感謝します。