<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vifix.cn &#187; xml</title>
	<atom:link href="http://vifix.cn/blog/tag/xml/feed" rel="self" type="application/rss+xml" />
	<link>http://vifix.cn/blog</link>
	<description>compile the dream, compile tomorrow</description>
	<lastBuildDate>Sun, 20 May 2012 15:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Javascript-XPath</title>
		<link>http://vifix.cn/blog/javascript-xpath.html</link>
		<comments>http://vifix.cn/blog/javascript-xpath.html#comments</comments>
		<pubDate>Mon, 06 Oct 2008 07:27:30 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=145</guid>
		<description><![CDATA[JavaScript-XPath是一个基于Javascript的高效的DOM 3 XPath (XPath 1.0)的解析器，支持IE6以上版本以及所有其它的现代浏览器 官方网站为：http://coderepos.org/share/wiki/JavaScript-XPath 官网示例： &#160; &#60;html&#62; &#60;head&#62;&#60;title&#62;Hello, DOM 3 XPath!&#60;/title&#62; &#160; &#60;!-- import JavaScript-XPath --&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;javascript-xpath.js&#34;&#62;&#60;/script&#62; &#160; &#60;!-- use XPath --&#62; &#60;script type=&#34;text/javascript&#34;&#62; // &#60;![CDATA[ function main() { &#160; // -- First case -- // Evaluate a XPath expression string var result = document.evaluate('//h1', document, null, 7, null); // Display [...]]]></description>
			<content:encoded><![CDATA[<p><span class="searchword0">JavaScript</span>-<span class="searchword1">XPath</span>是一个基于Javascript的高效的<a class="ext-link" href="http://www.w3.org/TR/DOM-Level-3-XPath/" onclick="pageTracker._trackPageview('/outgoing/www.w3.org/TR/DOM-Level-3-XPath/?referer=');"><span class="icon">DOM 3 XPath</span></a> (XPath 1.0)的解析器，支持IE6以上版本以及所有其它的现代浏览器</p>
<p>官方网站为：<a href="http://coderepos.org/share/wiki/JavaScript-XPath" onclick="pageTracker._trackPageview('/outgoing/coderepos.org/share/wiki/JavaScript-XPath?referer=');">http://coderepos.org/share/wiki/JavaScript-XPath</a></p>
<p>官网示例：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Hello, DOM 3 XPath!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- import JavaScript-XPath --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;javascript-xpath.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- use XPath --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
// <span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">function main() {</span>
&nbsp;
<span style="color: #339933;">  // -- First case --</span>
<span style="color: #339933;">  // Evaluate a XPath expression string</span>
<span style="color: #339933;">  var result = document.evaluate('//h1', document, null, 7, null);</span>
<span style="color: #339933;">  // Display the result</span>
<span style="color: #339933;">  var h1 = result.snapshotItem(0);</span>
<span style="color: #339933;">  alert(h1.innerHTML); // Hello, DOM 3 XPath!</span>
&nbsp;
<span style="color: #339933;">  // -- Second case --</span>
<span style="color: #339933;">  // Create a XPath expression object</span>
<span style="color: #339933;">  var expr = document.createExpression('//h1', null);</span>
<span style="color: #339933;">  // Evaluate a XPath expression object</span>
<span style="color: #339933;">  result = expr.evaluate(document, 7, null);</span>
<span style="color: #339933;">  // Display the result</span>
<span style="color: #339933;">  h1 = result.snapshotItem(0);</span>
<span style="color: #339933;">  alert(h1.innerHTML); // Hello, DOM 3 XPath!</span>
<span style="color: #339933;">};</span>
<span style="color: #339933;">// ]]&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;body</span> <span style="color: #000066;">onload</span>=<span style="color: #ff0000;">&quot;main()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Hello, DOM 3 XPath!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h1<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/javascript-xpath.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimpleXML真是个好东西</title>
		<link>http://vifix.cn/blog/simplexml%e7%9c%9f%e6%98%af%e4%b8%aa%e5%a5%bd%e4%b8%9c%e8%a5%bf.html</link>
		<comments>http://vifix.cn/blog/simplexml%e7%9c%9f%e6%98%af%e4%b8%aa%e5%a5%bd%e4%b8%9c%e8%a5%bf.html#comments</comments>
		<pubDate>Fri, 03 Oct 2008 01:00:11 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=135</guid>
		<description><![CDATA[这两天写一个页面需要访问一个RSS并且读取rss内的的文章标题和文章的链接，就尝试了一下PHP5的新特性也就是这个SimpleXML，直接支持xpath获取，确实很方便啊 ： $file = file_get_contents&#40;&#34;__YOUR__RSS__URL__HERE__&#34;&#41;; &#160; $xml = new SimpleXMLElement&#40;$file&#41;; &#160; $titles = $xml -&#62; xpath&#40;&#34;/rss/channel/item/title&#34;&#41;; $links = $xml -&#62; xpath&#40;&#34;/rss/channel/item/link&#34;&#41;; 然后就对$titles和$links这两个数组进行操作即可。]]></description>
			<content:encoded><![CDATA[<p>这两天写一个页面需要访问一个RSS并且读取rss内的的文章标题和文章的链接，就尝试了一下PHP5的新特性也就是这个SimpleXML，直接支持xpath获取，确实很方便啊 ：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;__YOUR__RSS__URL__HERE__&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleXMLElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$titles</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xml</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">xpath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/rss/channel/item/title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$links</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xml</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">xpath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/rss/channel/item/link&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>然后就对$titles和$links这两个数组进行操作即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/simplexml%e7%9c%9f%e6%98%af%e4%b8%aa%e5%a5%bd%e4%b8%9c%e8%a5%bf.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

