So I’m writing an android app that needs to grab book price data from the web. I found isbndb.com which seems to provide good reasourses and price comparison. The only issue is that their xml files are a bit complex.
I am new to parsing XML in Java and don’t know too much. I know how to parse basic xml files. With simple tags. I usually use the DocumentBuilder and the DocumentBuilderFactory However this is the part of the file which I’m trying to parse.
<Prices price_time="2012-04-08T20:05:49Z">
<Price store_isbn="" store_title="Discworld: Thief of Time" store_url="http://isbndb.com/x/book/thief_of_time/buy/isbn/ebay.html" store_id="ebay" currency_code="USD" is_in_stock="1" is_historic="0" check_time="2008-12-09T12:00:51Z" is_new="0" currency_rate="1" price="0.99"/>
<Price store_isbn="" store_title="" store_url="http://bookshop.blackwell.com/bobus/scripts/home.jsp?action=search&type=isbn&term=0061031321&source=1154376025" store_id="blackwell" currency_code="USD" is_in_stock="0" is_historic="0" is_new="1" check_time="2011-11-08T02:54:15Z" currency_rate="1" price="7.99"/>
</Prices>
What I am trying to do is grab the info in the attribute values such as store_isbn or store_title. If anyone could help me with this I would really appreciate it.
Thanks
You can use the above mentioned link for parsing xml and For retrieving the attribute values you can use following.
attributes.getValue(“store_title”) method will be used for parsing attribute values. Hope it will help.