Library price comparison prototype

Source: Internet
Author: User
Library price comparison prototype

I improved the library query prototype and added the favorites function to write a library query prototype. It is used to cope with library enterprise applications. In fact, mobile devices should primarily be end consumers.

For example, in this scenario, I actually need to read a book in a bookstore, scan the ISBN number, view the book reviews, and then I think it is really good, I also want to see the prices of various online bookstores.

For book reviews, Douban provides open APIs. However, there is no price comparison. However, Douban provides Web pages. For example:

Http://book.douban.com/subject/4803982/buylinks

This is the price comparison page of the book "Beautiful team.

We can see that all major online bookstores are included. The idea is that we can parse the page of the link and extract the price and other information.

Here I have tried three methods:

  1. The xmlpull provided by Android parses the information of the required node, but it does not work because the page is not a standard XHTML page. Although the page declares the schema of the XHTML page, there is a tag with no ending mark, parsing exception;
  2. The regular expression is used to locate the content in the required tag, but it is not successful, because the pre-search in the search is difficult to write, the intermediate character changes a lot, wait for time to ponder, the advantage of this method is that you do not need to attach a class library;
  3. When using htmlparser, that is, the method used below, the disadvantage is that you need to add a class library, but it is quite easy to use.


For the code, see:


 

Http://easymorse.googlecode.com/svn/tags/compare.price-0.1/

Running status:

The actual use of wifi should reduce the time, because it takes a little time to use 3G dialing.

Use htmlparser. Official Website:

Http://htmlparser.sourceforge.net/

The filter method is used to filter out the desired HTML node list.

I filtered out 10 A nodes, and then I knew the first two nodes were useless. The next eight A nodes are displayed in pairs. They are the names and prices of online bookstores.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.