我想制作一个应用程序(在C#中),其中我必须从wiktionary.com或dictionary.com等网站获取一些含义。但是我从来没有使用过Xml,或者根本没有使用过网页。阅读网页中的特定内容?
我设法得到网页的响应(例如从一个特定的词dictionary.com)(我希望是xml格式)。
这是我得到了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<!--attributes for answers reference-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
<title>
Hello | Define Hello at Dictionary.com
</title>
<meta name="description" content="Hello definition, (used to express a greeting, answer a telephone, or attract attention.) See more."/>
<meta name="keywords" content="hello, online dictionary, English dictionary, hello definition, define hello, definition of hello, hello pronunciation, hello meaning, hello origin, hello examples"/>
<link rel="canonical" href="http://dictionary.reference.com/browse/hello"/>
<meta property="og:title" content="the definition of hello"/>
<meta property="og:site_name" content="Dictionary.com"/>
<meta property="og:image" content="http://sp2.dictionary.com/en/i/dictionary/facebook/dictionary_logo.png"/>
现在我想解析以下字符串进行响应的话“你好”。:。
used to express a greeting, answer a telephone, or attract attention.
我试过使用XmlReader但卡住了。有人可以帮我阅读这些内容吗?
小心屏幕抓取,如果这就是你在做什么的另一种选择。很多时候它违反了网站的条款和条件,你的实现也将与他们的html格式紧密结合。如果他们改变他们的网站,很多时候你的代码将不再工作。 – BrandonZeider 2011-04-11 13:22:29