연구의 몇 일 후에 나는 마침내 해결책을 발견 또는 Google 제품에 액세스하기위한 항목이 있으면 일반 URL을 통해 쉽게 쿼리 할 수 있습니다.
http://www.google.com/base/feeds/snippets을 통해 Google Base 및 Google 제품의 공개 항목에 액세스 할 수 있습니다. 이 URL에 특정 검색어를 추가 할 수 있습니다 (예 :? bq = digital + camera). 디지털 카메라를 검색하는 경우 또는? bq = 5030932067876이면 실제 EAN 코드를 검색합니다.
해당 쿼리의 결과를 보유한 XML 문서가 다시 제공됩니다.
이
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gm='http://base.google.com/ns-metadata/1.0' xmlns:g='http://base.google.com/ns/1.0' xmlns:batch='http://schemas.google.com/gdata/batch'>
<id>http://www.google.com/base/feeds/snippets</id>
<updated>2010-07-27T15:52:29.459Z</updated>
<title type='text'>Items matching query: 5030932067876</title>
<link rel='alternate' type='text/html' href='http://base.google.com'/>
<link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/base/feeds/snippets'/>
<link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://www.google.com/base/feeds/snippets/batch'/>
<link rel='self' type='application/atom+xml' href='http://www.google.com/base/feeds/snippets?start-index=1&max-results=25&bq=5030932067876'/>
<author>
<name>Google Inc.</name>
<email>[email protected]</email>
</author>
<generator version='1.0' uri='http://base.google.com'>GoogleBase</generator>
<openSearch:totalResults>20</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<entry>
<id>http://www.google.com/base/feeds/snippets/6567855098786723080</id>
<published>2009-06-17T19:10:11.000Z</published>
<updated>2010-07-26T19:36:16.000Z</updated>
<category scheme='http://base.google.com/categories/itemtypes' term='Produkte'/>
<title type='text'>Xb360 Fifa 09 Electronic Arts EAD07606316 5030932067876</title>
<content type='html'>FIFA 09 Die brandneue Fußballsimulation! Geh in FIFA 09 auf den Platz und spiel professionellen Fußball, so wie du ihn dir vorstellst. Erlebe die authentischste Fußballsimulation, die EA SPORTS? je veröffentlicht hat, lebe deinen Traum vom ...</content>
<link rel='alternate' type='text/html' href='http://www.mercateo.com/p/615IT-R78802/Xb360_Fifa_09.html?PageID=FG-615IT-R78802'/>
<link rel='self' type='application/atom+xml' href='http://www.google.com/base/feeds/snippets/6567855098786723080'/>
<author>
<name>Mercateo.com</name>
</author>
<g:zustand type='text'>neu</g:zustand>
<g:mpn type='text'>EAD07606316</g:mpn>
<g:image_link type='url'>http://images.mercateo.com/images/products/voelkner/906692_bb_00_fb.eps.jpg</g:image_link>
<g:item_language type='text'>DE</g:item_language>
<g:ean type='text'>5030932067876</g:ean>
<g:id type='text'>615IT-R78802</g:id>
<g:shipping type='shipping'>
<g:price>4.76 eur</g:price>
</g:shipping>
<g:target_country type='text'>DE</g:target_country>
<g:preis type='floatUnit'>34.14 eur</g:preis>
<g:expiration_date type='dateTime'>2010-08-25T19:36:16Z</g:expiration_date>
<g:marke type='text'>Electronic Arts</g:marke>
<g:customer_id type='int'>114950</g:customer_id>
<g:item_type type='text'>Produkte</g:item_type>
</entry>
당신은 단지 다음을 수행하여이 내용을 구문 분석 할 수 있습니다 (... 더 져야 할 엔트리가 ... 올) : 다음을 하위 클래스 예를 들어, URL http://www.google.com/base/feeds/snippets?bq=5030932067876는 다음과 같은 XML-문서를 다시 제공 org.xml.sax.helpers.DefaultHandler. 그리고 (작동하도록 수입 javax.xml.parsers.SAXParser 및을 javax.xml.parsers.SAXParserFactory) 다음 코드로 myHandler가 초기화 :
이
MyHandler myHandler = new MyHandler();
String urlString = "http://www.google.com/base/feeds/snippets?bq=5030932067876";
URL link = new URL(urlString);
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
xr.setContentHandler(myHandler);
InputStream stream = link.openStream();
InputSource inputSource = new InputSource(stream);
inputSource.setEncoding("ISO-8859-1");
xr.parse(inputSource);
이가 MyHandler를 서브 클래 싱 방법에 따라 개체 myHandler가 모두 있어야한다 방금 파싱 한 값입니다.
희망이 있으면 도움이됩니다.