爱词霸是个翻译网站(跟金山词霸有关),http://dict-co.iciba.com/api/dictionary.php?w=*是他的接口(结尾的*可以替换成单词),请问,如果利用这些在自己编的JAVA程序中实现查词的功能?

解决方案 »

  1.   

    比如查询world,返回:<dict num="219" id="219" name="219"><key>world</key><ps>wə:ld</ps><pron>http://res.iciba.com/resource/amp3/7/d/7d793037a0760186574b0282f2f435e7.mp3</pron><pos>n.</pos><acceptation>世界, ...界, 世事, 世故, 社会</acceptation><pos>adj.</pos><acceptation>世界的</acceptation><sent><orig>World Economy</orig><pron>http://res.iciba.com/resource/phrase_mp3/f/e/fe1ab1e846d506aa6acec9217f7013ab.mp3</pron><trans>一、世界经济。</trans></sent><sent><orig>world war</orig><pron>http://res.iciba.com/resource/phrase_mp3/4/3/4386efc0f33b6529fc5bd7619ef23812.mp3</pron><trans>世界大战</trans></sent><sent><orig>world cup</orig><pron>http://res.iciba.com/resource/phrase_mp3/1/a/1a6042005cb9699c5df0ee1dd43d1c89.mp3</pron><trans>世界杯</trans></sent><sent><orig>world famous; world-renowned</orig><pron>http://res.iciba.com/resource/phrase_mp3/2/2/22bca9cfddeeba6c243eb03f92f8bd42.mp3</pron><trans>闻名世界</trans></sent><sent><orig>world atlas</orig><pron>http://res.iciba.com/resource/phrase_mp3/2/f/2fa18c36296595a32388f25ea64112e1.mp3</pron><trans>世界地图集</trans></sent></dict>
    只要稍微过滤一下就可以了(用正则表达式)~
      

  2.   

    完全可以,这个就是爱词霸提供的Web Service在java程序中用httpclient来通过http协议调用那个查词服务返回的是xml格式的文件,直接解析就ok了。用dom4j,jdom等等