<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[暂时的雅译网]]></title> 
<description><![CDATA[打算做个超级外语翻译网站,域名已经想好了,但是没有找到我想要的程序,所以只好自己写了,在程序还没有写出来之前,本人只进行简单的英汉互译,偶尔还写写seo技术,但基本上都是涉及编程方面的.]]></description>
<link>http://www.7bing.org</link>
<language>zh-cn</language>
<generator>www.emlog.net</generator>

<item>
	<title>强力推荐,你不得不看的一部电影--贫民窟的百万富翁</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=23</link>
	<description><![CDATA[<p><a id="ematt:7" target="_blank" href="http://www.7bing.org/content/uploadfile/200901/ff59d7bcfa9953afed834a7e25d23cb620090101055120.jpg"><img alt="点击查看原图" border="0" src="http://www.7bing.org/content/uploadfile/200901/ff59d7bcfa9953afed834a7e25d23cb620090101055120.jpg" /></a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 谁会想到我大元旦的居然还在看一部印度电影,谁又会想到这部电影又会是如此震撼人心.很难用语言描述这样一部让我大半夜还在细细品读的作品,儿时伤痛的记忆,散落在浴缸里的花花绿绿的钞票,不断变幻的时空,两千万卢比只为换回佳人莞尔一笑.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果你是女生,我敢保证你一定会一边哭一边把电影的后半部分看完,如果你是男生,我敢保证你一定会审视自己的内心,寻找一位曾让你魂牵梦绕的姑娘.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;看完电影我的评分是:100分,估计很难再看到这么有水准的电影了.发于心,而止于爱.</p>
<p>&nbsp;</p>
<p>故事简介:</p>
<p>故事的主角名叫贾马尔&middot;马利克，一个自小失去双亲在孟买贫民窟长大的青年。18岁的他将在全国人民的注视下经历他人生中最辉煌的一晚。他参加了一档名为《谁想成为百万富翁》的电视节目，该节目将举国上下的热情都煽动到了最高点，而成为焦点的贾马尔离真正的成功只有一步之遥&mdash;&mdash;只要他正确回答最后一道问题，令人垂涎的2000万卢比将归他所有。<br />
<br />
　　就在答案快揭晓的时刻，警方却以贾马尔&middot;马利克作弊为由将其带走，等待贾马勒的可能是诈骗嫌疑的控罪。但一个&ldquo;街头仔&rdquo;何以在举国关注的电视节目中作弊？到底对贾马勒的诈骗控罪是否成立？这些问题都牵动着大家的心。<br />
<br />
　　为了能洗脱罪名证明自己的清白无辜，贾马尔竭尽所能地讲述了自己18年来艰苦的生活遭遇：他和他的兄弟如何在贫民窟艰难度日；他们在公路上的冒险经历；他们与地方黑帮的惊险&ldquo;遭遇战&rdquo;；他如何失去了心爱的女子拉媞卡。<br />
<br />
　　通过他对自己艰难人生的描述，所有人都明白了他能回答出电视节目里的那些问题绝非偶然和作弊。随着他的回忆，展示在大家面前的除了是他的人生经历外，还有就是他能答对如此之多的题目的真实原因&mdash;&mdash;从他的生活经历中都能够找出每道题的答题线索，他能够从他的人生经历中得到启示。当大家消除了贾马尔作弊的疑问后，另一个神秘问题又盘踞在大家心头：如若真如贾马尔自己所说那样，参加该节目并不是对金钱和财富的欲望，那到底是什么力量在促使这位&ldquo;街头仔&rdquo;参与到这个节目当中并坚持到最后？令电视节目的制作方、巡视员和超过千万的电视观众都大跌眼镜的是，他这样做仅仅是为了找到昔日的恋人拉媞卡，因为她是《谁想成为百万富翁》的忠实拥趸。新的一天就要来临，贾马尔将会给出最后一题的答案。他能不能找回拉媞卡呢？</p>]]></description>
	<pubDate>Thu, 01 Jan 2009 05:52:18 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=23</guid>

</item>
<item>
	<title>php没有啥子难学的,只要你多想想</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=22</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 其实php这东西没有啥子难学的,我不是计算机专业的学生,也没有任何计算机天赋,接触网络,接触编程也不过就是07年初而已,正式学习php也不过是在08年5月份左右.这期间真是感觉了学习一门完完全全崭新的知识的痛苦,从面向过程,数据类型,流程控制,算法,函数到面向对象,抽象类,接口,多态.为了理解这些以前听都没有听过的古怪的概念实在是杀了不少脑细胞.每次遇到貌似艰深的概念我都会有放弃php学习的念头,但是总又在不经意间揣摩出了其中的奥妙.这样的感觉实在是说不出的妙.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 经过这么长时间的学习,我发现了一个学习的诀窍,那就是多想想.看看手册多想想,看看高手的代码多想想,运行一下代码多想想.任何问题,多想想就ok了.</p>]]></description>
	<pubDate>Mon, 29 Dec 2008 16:17:11 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=22</guid>

</item>
<item>
	<title>php5.3.0尝鲜:新特性小介绍之nowdoc</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=21</link>
	<description><![CDATA[<p>本来一直在看中文版的php手册,但是谁知道这个中文版的翻译真是漏洞百出的,而且居然连原手册中的例子都能给搞错,暴汗了一下.于是一咬牙,一狠心,一跺脚下载了一个英文的手册.还挺新,12月-5号出的.一口气看到字符串一章,真是爽到家了.就在此时,说时迟那时快,发现字符串一章有了新内容-----nowdoc!!!!!!!!!!!!!!!这还得了,赶紧研究了一下,原来是php5.3.0版新引进的.貌似还没有注意到哦,所以俺就先下手为抢,抢先翻译一下这个新东东.<br />
<br />
<br />
Nowdocs are to single-quoted strings what heredocs are to double-quoted strings. A nowdoc is specified similarly to a heredoc, but <i>no parsing is done</i> inside a nowdoc. The construct is ideal for embedding <span class="t_tag" href="tag.php?name=PHP" onclick="tagshow(event)">PHP</span> code or other large blocks of text without the need for escaping. It shares some features in common with the SGML <i>&lt;![CDATA[ ]]&gt;</i> construct, in that it declares a block of text which is not for parsing. <br />
与heredocs针对于双引号字符串相比,nowdoc针对的是单引号内的字符串.虽然nowdoc的定义方式同heredoc相似,但是在一个nowdoc中,变量和转义字符串(单引号和反斜线除外,译者注)不会被解析.这种语法结构非常适合在需要嵌入php代码或者其他大量文本块,但是却不必进行转义的时候使用.在某些特性上上nowdoc同SGML的&lt;![CDATA[]]&gt;结构相同,可以在这个结构中声明一段文本块且不会对其进行解析.<br />
A nowdoc is identified with the same <i>&lt;&lt;&lt;</i> seqeuence used for heredocs, but the identifier which follows is enclosed in single quotes, e.g. <i>&lt;&lt;&lt;'EOT'</i>. All the rules for heredoc identifiers also apply to nowdoc identifiers, especially those regarding the appearance of the closing identifier. <br />
nowdoc使用同heredoc一样的序列,但是在其后所使用的界定符使用单引号包围起来,例如,&lt;&lt;&lt;'EOT'.所有heredoc遵守的规则同样适用于nowdoc, 特别是对于结束界定符的限定.<br />
<strong>例子 #4 Nowdoc string quoting example</strong><br />
<font color="#000000"><font color="#0000bb"><font face="新宋体 ">&lt;?php<br />
$str </font></font><font color="#007700"><font face="新宋体 ">= &lt;&lt;&lt;'EOD'<br />
</font></font><font color="#dd0000"><font face="新宋体 ">Example of string<br />
spanning multiple lines<br />
using nowdoc syntax.<br />
</font></font><font color="#007700"><font face="新宋体 ">EOD;<br />
<br />
</font></font><font face="新宋体 "><font color="#ff8000">/* 更复杂点的例子, 包含一些变量 */<br />
</font><font color="#007700">class </font></font><font color="#0000bb"><font face="新宋体 ">foo<br />
</font></font><font face="新宋体 "><font color="#007700">{<br />
&nbsp; &nbsp; public </font><font color="#0000bb">$foo</font></font><font face="新宋体 "><font color="#007700">;<br />
&nbsp; &nbsp; public </font><font color="#0000bb">$bar</font></font><font face="新宋体 "><font color="#007700">;<br />
<br />
&nbsp; &nbsp; function </font><font color="#0000bb">foo</font></font><font face="新宋体 "><font color="#007700">()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$this</font><font color="#007700">-&gt;</font><font color="#0000bb">foo </font><font color="#007700">= </font><font color="#dd0000">'Foo'</font></font><font face="新宋体 "><font color="#007700">;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$this</font><font color="#007700">-&gt;</font><font color="#0000bb">bar </font><font color="#007700">= array(</font><font color="#dd0000">'Bar1'</font><font color="#007700">, </font><font color="#dd0000">'Bar2'</font><font color="#007700">, </font><font color="#dd0000">'Bar3'</font></font><font face="新宋体 "><font color="#007700">);<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
</font><font color="#0000bb">$foo </font><font color="#007700">= new </font><font color="#0000bb">foo</font></font><font face="新宋体 "><font color="#007700">();<br />
</font><font color="#0000bb">$name </font><font color="#007700">= </font><font color="#dd0000">'MyName'</font></font><font color="#007700"><font face="新宋体 ">;<br />
<br />
echo &lt;&lt;&lt;'EOT'<br />
</font></font><font color="#dd0000"><font face="新宋体 ">My name is &quot;$name&quot;. I am printing some $foo-&gt;foo.<br />
Now, I am printing some {$foo-&gt;bar[1]}.<br />
This should not print a capital 'A': \x41<br />
</font></font><font face="新宋体 "><font color="#007700">EOT;<br />
</font><font color="#0000bb">?&gt;</font> </font></font><br />
<br />
<br />
The above example will output:<br />
上面的例子将会输出:<br />
My name is &quot;$name&quot;. I am printing some $foo-&gt;foo.Now, I am printing some {$foo-&gt;bar[1]}.This should not print a capital 'A': \x41<br />
<br />
&nbsp;</p>
<blockquote><strong>Note</strong>: Unlike heredocs, nowdocs can be used in any static data context. The typical example is initializing class members or constants: <br />
<br />
注意:和heredoc不同,nowdocs可以在任何静态数据环境中(对这个地方理解的不是很到位,不晓得译的对不对).比较典型的例子是用在初始化类成员或常数时:<br />
<br />
<strong>例子 #5 Static data example</strong><br />
<font color="#000000"><font face="新宋体 "><font color="#0000bb">&lt;?php<br />
</font><font color="#007700">class </font><font color="#0000bb">foo </font></font><font face="新宋体 "><font color="#007700">{<br />
&nbsp; &nbsp; public </font><font color="#0000bb">$bar </font></font><font color="#007700"><font face="新宋体 ">= &lt;&lt;&lt;'EOT'<br />
</font></font><font color="#dd0000"><font face="新宋体 ">bar<br />
</font></font><font face="新宋体 "><font color="#007700">EOT;<br />
}<br />
</font><font color="#0000bb">?&gt;</font> </font></font><br />
<br />
<br />
<br />
</blockquote><blockquote><strong>Note</strong>: Nowdoc support was added in PHP 5.3.0. <br />
<br />
注意:Nowdoc在php5.3.0中引入<br />
</blockquote>
<p>&nbsp;</p>]]></description>
	<pubDate>Thu, 11 Dec 2008 22:48:34 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=21</guid>

</item>
<item>
	<title>提供&lt;谷歌官方搜索引擎优化指南&gt;英文原版下载</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=20</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 本来自己正在做这个官方版的翻译的,但是由于我太注重尊重原文的意思,导致翻译计划有所推迟,本来已经翻了一半了,发现工作量仍然还是很大,暂时不会发布我不叫大脸猫版的中文译本.最迟一个周之后大家就可以见到用最纯正的中文翻译的官方版指南啦.敬请期待ing!</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 先提供英文版的下载,有能力的就先研究着,水平不行的就等我的版本吧.</p>]]></description>
	<pubDate>Tue, 18 Nov 2008 22:02:12 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=20</guid>

</item>
<item>
	<title>翻译计划-&gt;php英文书籍-&gt;php6和Mysql创建动态站点</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=19</link>
	<description><![CDATA[<p><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;; mso-bidi-font-family: Tahoma; mso-fareast-font-family: 宋体; mso-font-kerning: .5pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA"><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600">&nbsp;&nbsp;&nbsp;&nbsp; 为了更好的学习php以及翻译,我决定进行一项很艰巨的翻译计划.下面这本书就是我在未来几个月内将要翻译的phpbook.所以我的博客以后只进行翻译活动,seo研究以及php技术研究都将转到我的<a target="_blank" href="http://www.7bing.org/blog">西安欧亚seo+php研究博客</a>上去,敬请关注.&nbsp;</v:shapetype></span></p>
<p><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;; mso-bidi-font-family: Tahoma; mso-fareast-font-family: 宋体; mso-font-kerning: .5pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA"><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"></v:shapetype></span></p>
<p><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;; mso-bidi-font-family: Tahoma; mso-fareast-font-family: 宋体; mso-font-kerning: .5pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA"><v:shapetype stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><a target="_blank" href="http://www.7bing.org/uploadfile/200811/bbf9ac57dc6bb66822a9ad4fce5ceed220081109031324.jpg"><img alt="点击查看原图" border="0" src="http://www.7bing.org/uploadfile/200811/thum-bbf9ac57dc6bb66822a9ad4fce5ceed220081109031324.jpg" /></a></v:shapetype></span></p>]]></description>
	<pubDate>Sun, 09 Nov 2008 03:16:55 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=19</guid>

</item>
<item>
	<title>php学习视频之二--客户端脚本与服务器端脚本</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=18</link>
	<description><![CDATA[<p>php学习视频之二:</p>
<p>客户端脚本与服务器端脚本</p>
<p><embed src="http://www.tudou.com/v/me6WV0jOznk" width="500" height="600" type="application/x-shockwave-flash"></embed></p>]]></description>
	<pubDate>Fri, 07 Nov 2008 11:35:50 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=18</guid>

</item>
<item>
	<title>php学习视频之一--什么是编程语言?(英文版)</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=17</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp; 自己在网上找的英文版的php入门视频教程,语速基本上慢的很,b级水平以上都能听的懂.顺便就当练练听力吧,说不定php学完了4,6级也碰巧过了呢.</p><p>&nbsp;&nbsp; 播放之前请关掉博客的背景音乐先.</p><p><embed type="application/x-shockwave-flash" height="600" width="600" src="http://www.tudou.com/v/rnEw-KYS77w" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></p>]]></description>
	<pubDate>Wed, 05 Nov 2008 11:53:07 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=17</guid>

</item>
<item>
	<title>关于我的第一次php讲座</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=16</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 昨天下午给大一的学弟学妹们做了个php讲座,这也是我人生的第一次讲座.讲座来的人也比较的少,只有不到二十个人,但是也足够让我紧张一番的.不过还好,讲座还是顺利的讲了,想传递给听众的信息也基本上都传递了.但是我还是觉得很不满意,因为我原本打算给他们多演示几个php网站程序的,由于我自己准备不充分吧,这几个程序居然没有完全拷贝下来,以至于在演示的时候出现了问题,最后只好作罢.只凭我讲的和演示的那么一点点东西还不足以让别人感受到php的强大和魅力所在.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 讲座结束的时候我向学弟学妹们提供了一个论坛地址,<a target="_blank" href="http://www.7bing.org/bbs">欧亚php学习论坛</a>,这个论坛我打算用来进行常规的php培训,帮助愿意和我一起学习php的人更快更好更精的学习到php技术.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 比较遗憾的是,我的第一次讲座居然没有拍几张照片留个纪念,真是挺失败的.希望下次可以弥补这个遗憾.</p>]]></description>
	<pubDate>Sat, 25 Oct 2008 09:58:35 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=16</guid>

</item>
<item>
	<title>zend官网上关于mvc模式的解释-(附原文及翻译)</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=15</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我学习php已经有一段时间了,在学习的过程中总是能够看到高手们在文章中提到mvc,但是貌似大家都对这个东西没有形成一个统一的权威的说法,所以我对mvc究竟是个什么东西也比较的茫然.很凑巧的,zend官网上介绍zend framework的一篇文章中提到了mvc,作为php的强有力支持者,我想zend关于mvc的解释应该算是比较权威的吧.于是乎就放到我的博客上,让更多的初学php的人能够理解这个概念.</p>
<p>原文:</p>
<ul>
    <li>Model- This is the part of your application that defines its basic functionality behind a set of abstractions. Data access routines and some business logic can be defined in the model.</li>
    <li>View- Views define exactly what is presented to the user. Usually controllers pass data to each view to render in some format. Views will often collect data from the user, as well. This is where you're likely to find HTML markup in your MVC applications.</li>
    <li>Controller- Controllers bind the whole pattern together. They manipulate models, decide which view to display based on the user's request and other factors, pass along the data that each view will need, or hand off control to another controller entirely. Most MVC experts recommend keeping controllers as skinny as possible.</li>
</ul>
<p>译文:</p>
<ul>
    <li>模式-这是应用中的一个部分,它基于一系列抽象概念定义应用的基本功能.数据存取方式和一些业务逻辑可以在模式中定义.</li>
    <li>视图-视图清楚的定义了把什么展示给用户.通常控制器传送数据到每一个视图,视图用一些格式对其进行解码.同样的,视图还会从用户那里收集数据.这也是你可以在mvc应用中找到Html标记的地方.</li>
    <li>控制器-控制器将所有的部分组织起来.它操作模式,确定使用哪个视图对用户的请求以及其他的事件进行展示,传送数据到每一个需要它的视图去,或者把控制权整个的转交到另一个控制器.大多数的mvc专家建议要保持控制器的简洁.</li>
</ul>
<p><img src="http://framework.zend.com/images/quickstart/ModelViewControllerDiagram.png" align="right" border="0" alt="" /></p>]]></description>
	<pubDate>Wed, 22 Oct 2008 11:20:28 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=15</guid>

</item>
<item>
	<title>自己做的招新海报!(附图,版权所有谢绝抄袭)</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=14</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp; 最近正忙着学习php,没太多时间翻译文章了,看来我要慢慢的补一补了.由于正在学校筹建php俱乐部,所以自己整了个招新海报玩玩.把海报贴出来秀一下分别是普通版和海报版两张:</p>
<p><a id="ematt:3" target="_blank" href="http://www.7bing.org/uploadfile/200810/4a2d190228c2f40aa671a5cf0092011420081013131656.png"><img alt="点击查看原图" border="0" src="http://www.7bing.org/uploadfile/200810/thum-4a2d190228c2f40aa671a5cf0092011420081013131656.png" /></a><a id="ematt:4" target="_blank" href="http://www.7bing.org/uploadfile/200810/4a2d190228c2f40aa671a5cf0092011420081013133643.png"><img alt="点击查看原图" border="0" src="http://www.7bing.org/uploadfile/200810/thum-4a2d190228c2f40aa671a5cf0092011420081013133643.png" /></a></p>]]></description>
	<pubDate>Mon, 13 Oct 2008 13:14:05 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=14</guid>

</item>
<item>
	<title>seo讲座--关键词仍然是决定百度排名的关键</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=13</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这篇文章的标题看起来有点傻逼,但是搞seo时间长的人就会发现这样一个问题:决定网站排名的永远就只有那么几个因素而已.用这样一句话来描述我的观点:nba决赛赛场上,a队领先b队2分,b队持球进攻,此时决定b队成败的并不是计时器走的慢一点儿,也不是对方防守松懈下来,而是b队持球队员的基本功,比如运球突破,三分远投,三步上篮等等.关键词在seo中的作用就在与此.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 大家在使用搜索引擎的时候往往会发现这样一个问题:一个很长的搜索语句得出的搜索结果会出现很不相关的页面,比如我今天搜索了&quot;php垃圾收集机制&quot;,没想到搜索结果的前5名中居然有这样一个页面:<a id="ematt:1" target="_blank" href="http://www.7bing.org/uploadfile/200810/55334a3c84d15d9ff8d0e8ceb303f51620081008104525.gif"><img alt="点击查看原图" border="0" src="http://www.7bing.org/uploadfile/200810/55334a3c84d15d9ff8d0e8ceb303f51620081008104525.gif" /></a></p>
<p>注意其中红色的文字就会发现,关键词被拆分成了数个字符串.你也许会说这没什么大惊小怪的,但是让我来告诉你一个了解搜索引擎的绝佳方法---查找最没有竞争力的关键词.为什么呢?因为在这里,任何非人为因素都被限制到了最小的程度,百度不会进行人工干预,不会搞竞价,seoer不会进行优化.你在这里所能看到的都是完完全全的算法产生的结果,这里的算法最透明,最容易理解,也最容易掌握.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 那么,我从这里得出了百度的什么算法呢?</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第一点:关键词密度,也就是关键词在页面上出现的次数,仍然决定了网页的排名.这个不相关的网页完全是因为出现了php,垃圾,收集这三个关键词.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第二点:内链,为什么我会说是内链呢?仅仅依靠网页重复几个关键词是无法达到排名提高的,通向这个页面的同站页面才能助力排名提升.细心的人一定会发现我给出的这个例子中出现的网站,不是别人,正是百度知道.百度知道从某方面来说,基本上就是搜索引擎优化的教科书,为什么?因为百度内部的算法共享(当然这肯定是很高层的机密).百度知道在进行程序设计之初就已经考虑到了百度算法,它的结构一定是最接近百度算法的结构,而从百度知道可以发现这样一个优化决定因素---内链.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;说了这么多了,关键词的意义也就是这样了---突出一些东西.至于你能让你的关键词突出什么东西,就看你能怎么使用关键词了.</p>]]></description>
	<pubDate>Wed, 08 Oct 2008 11:03:26 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=13</guid>

</item>
<item>
	<title>假期兼职见闻</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=12</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp; 假期兼职去了,整个十一一直没有休息,连编程文章也没时间翻译.每天真可谓是早出晚归.具体工作是给参加传说中的舞蹈大赛的选手进行检录.这样的工作简直就是要人命一样,每天早上8:00准时开始检录,12:40休息一下,1:00又继续开始下午的检录,7:00休息一下,7:30又继续,直到晚上11:00.检录过程中我和其他的几个大学生几乎都是在歇斯底里的叫号,维持秩序,寻找一些傻逼到不知道自己的号被叫到的选手.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;不过还是有很大的收获的,每天能够看到200场国标舞比赛,其中不乏专业级以及大师级的人物,有一个选手竟然是亚洲冠军,实在是牛的不行.比赛结束的时候和一起奋战了几天的兄弟们照了几张相,不知道还能找到不.找到了就给贴出来.顺便也放几张比赛照片.</p>]]></description>
	<pubDate>Mon, 06 Oct 2008 09:06:12 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=12</guid>

</item>
<item>
	<title>关于红旗Linux=&gt;php构建环境中的新生儿</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=11</link>
	<description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 昨天混进计算机系的讲座中去了,因为讲座是关于linux的,所以我义不容辞的就过去了.结果去了之后发现只有我一个是非计算机专业的学生,于是很尴尬的坐在一个不受关注的地方.讲座和我们平时所知道的Linux完全就不是一个概念,红旗Linux只是基于Linux的内核开发的中国式的操作系统,或许连内核都改的差不多了.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 今天就很好奇的上网搜了搜红旗Linux,没想到phpchina上就已经有人发布了红旗Linux + apache + MySQL + php的php环境包,看来红旗Linux搞的还挺像那么回事.不过我的最大的疑问就是,相对于微软的操作系统来说,红旗Linux确实算是中国自主研发的操作系统,但是内核毕竟还是有很大的部分是从国外弄来的,由此看来中国的软件发展水平好像还是不怎么值得拿出来炫耀的.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 讲座结束的时候每个到场的人都拿到了红旗Linux桌面版5.0的安装盘,我也弄了一份,中午准备装上看看传说中的linux是什么样子,顺便截几个图片放出来秀一下.</p>]]></description>
	<pubDate>Fri, 26 Sep 2008 12:54:33 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=11</guid>

</item>
<item>
	<title>Using XML: A PHP Developer's Primer, Part 2=&gt;操作XML:php开发人员入门(第二部分)原文+译文1</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=10</link>
	<description><![CDATA[<div class="articleHeader" style="margin-left: 80px">&nbsp;&nbsp;&nbsp; 鉴于这个博客程序的文本存储很差,我自行更改了数据库中文本存储的类型,改为了超长文本类型,应该可以存下很大的文章了吧.我接下来要翻译的这篇文章貌似有点儿太长了,光英文就有4页多,翻成汉语估计我就要疯掉了.</div><div class="articleHeader" style="margin-left: 80px">&nbsp;</div><div class="articleHeader" style="margin-left: 80px">原文:</div><div class="articleHeader" style="margin-left: 80px">&nbsp;</div><div class="articleHeader" style="margin-left: 80px">An Introduction to AJAX</div><div class="articlePara" style="margin-left: 80px">In the first part of this series, we took a look at how PHP 5 can be used to manipulate and parse XML files. In this installment, we are going to focus on Ajax, one of the most useful and topical applications of XML.</div><div class="articlePara" style="margin-left: 80px">Initially, we are going to introduce Ajax and learn how to use the XMLHTTP object provided by most modern web browsers to create a live email validation form. Then we will pick up where we left off with the theme of XML and introduce XSLT, which we will use to transform our library XML from the previous article into valid XHTML code.</div><div class="articleHeader" style="margin-left: 80px">What is AJAX?</div><div class="articlePara" style="margin-left: 80px">There exists today a huge number of web applications that do everything from manage your photos, to mission-critical distributed systems. The majority of these applications exist in three parts.</div><div class="articlePara"><ul><li><p>The <i>back end</i> section is usually where the data pertinent to the application is stored. The back end may include logic which deals with the update and retrieval of this data in the form of server side code, SQL and stored procedures.</p></li><li><p>The <i>middle ware</i> section is where all the magic happens, typically transforming, manipulating, retrieving, verifying an validating the data before sending it on to the front end.</p></li><li><p>The <i>front end</i> section is what the user interacts with; it often contains very little logic and simply acts as an engine which initiates the communication with the middle end. Although the front end does not do much in terms of the application logic, it is probably the single most important part of the application. A poorly designed and awkward-to-use front end makes all the magic of the middle ware redundant.</p></li></ul></div><div class="articlePara" style="margin-left: 80px"></div><div class="articlePara" style="margin-left: 80px">In most web applications, the invocation of logic on the middle ware, which may or may not change the information presented to the user, requires that the user click a link or submit data via a form. This in turn requires that the entire page be refreshed and all data be resent to the user. This is OK when a large portion of the page is being refreshed, but it is very wasteful if little or no data is to be updated.</div><p style="margin-left: 80px"><img title="Traditional Web Application" height="129" alt="Traditional Web Application" width="660" align="left" src="http://www.phpbuilder.com/columns/webapp1.gif" /></p><div class="articlePara" style="margin-left: 80px">The philosophy behind Ajax is that when a user makes a request to the server-side part of the application, only the data which is required is sent back to the user and rather than reloading the entire page, only the parts which require updating are updated.</div><div class="articlePara" style="margin-left: 80px">Ajax is an acronym for Asynchronous Javascript And XML. It is the use of Javascript code in HTML pages that allows it to make independent requests to the web server. XML is by no means mandatory in an Ajax solution and, in some cases it is completely unnecessary. With Ajax, the front end is split into two parts: the HTML and CSS which deals with the page display and the Ajax engine.</div><p style="margin-left: 80px"><img title="Ajax Application" height="152" alt="Ajax Application" width="720" align="left" src="http://www.phpbuilder.com/columns/webapp2.gif" /></p><div class="articlePara" style="margin-left: 80px">The Ajax engine is responsible for initiating two way communication with the server in response to user events on the page. It enables developers to enrich and enhance the usability of web applications by creating powerful event driven web front ends, similar to the kind that we are accustomed to on the desktop domain, which respond in almost real time.</div><div class="articlePara" style="margin-left: 80px">You can see a more detailed definition of Ajax and how it fits into the the web design domain, by reading Chapter 1 of the Ajax in Action.</div><div class="articleHeader" style="margin-left: 80px">Live E-Mail Validation with AJAX</div><div class="articlePara" style="margin-left: 80px">We are now going to dive into the world of AJAX by creating a simple application which validates and verifies a user's email address while they are filling out a web form. A prior knowledge of HTML and Javascript is beneficial when following this article, however there is no better way of learning than to manually copy (not copy and paste) and implement the solution yourself.</div><div class="articlePara" style="margin-left: 80px">Normally, email validation and verification is carried out by the server. It often involves a syntax check and the sending of an email containing a link and verification code, which, once clicked, confirms that the email is real and active.</div><div class="articlePara" style="margin-left: 80px">Our small application will do all of this before the form is submitted, or more precisely, while it is being filled out. This kind of feature is especially useful if the form takes several minutes to complete and it can also be extended to include a randomly generated image in place of a plain text code in the verification.</div><div class="articlePara" style="margin-left: 80px">To assist in the creation of our small AJAX application, I have created an Email Validation class, email_validator.php which provides the tools necessary to validate and verify an email address. It uses a SqLite database to store email addresses which are to be verified and provides the necessary methods to check the syntax of the email, validate domain part of the email and sends a randomly generated verification code the email address.</div><div class="articlePara" style="margin-left: 80px">The source code for this class and the documentation can be downloaded in <a href="http://www.phpbuilder.com/columns/email_validator.zip"><font color="#244276">this ZIP file</font></a>.</div><div class="articleHeader2" style="margin-left: 80px">Coding for AJAX</div><div class="articlePara" style="margin-left: 80px">It is worth remembering that when introducing or including Ajax in web applications, the coding becomes more complex.</div><div class="articlePara"><ul><li><p>Both the Ajax engine and the server side script must understand the context of the request and the response.</p></li><li><p>The order of the requests and responses between the Ajax engine and the server side script (if important), must be known, as there is no guarantee that they will be received in the order that was intended.</p></li><li><p>The server side part of the application must treat any data received from the Ajax engine as &ldquo;soiled&rdquo; until it has been validated and verified as correct.</p></li><li><p>The Ajax engine must treat data received from the server as &ldquo;soiled&rdquo; until validated and verified.</p></li><li><p>The application should still be fully functional via the regular click and reload mechanism, should Javascript be disabled or unsupported by user's browser.</p></li></ul></div><div class="articleHeader" style="margin-left: 80px">The Server-Side PHP</div><div class="articlePara" style="margin-left: 80px">Our Ajax engine's partner in crime will be a small PHP script called email_validate.php. It receives the data from the Ajax engine, processes it by carrying out the required action and sends a plain text response.</div><div class="articleHeader" style="margin-left: 80px">Validating the Data</div><div class="articlePara" style="margin-left: 80px">The data from the Ajax engine will be passed to our script in the URL query string. The three values which are sent are as follows:</div><div class="articlePara"><ul><li><p>action &ndash; The action must be sent to the script and is used to specify what we want the script to do.</p><ul class="articlePara"><li><p>validate &ndash; to validate the email</p></li><li><p>verify &ndash; to verify the verification code</p></li></ul></li><li><p>id &ndash; an ID previously generated by our script and sent to the Ajax engine. We can use this ID to retrieve the email from the <font size="2">SqLite</font> database by passing it to the constructor of the EmailValidator object.</p></li><li><p>email &ndash; the email address we wish to verify or validate.</p></li><li><p>v_code &ndash; only required when we have an action of verify. The verification code to check against the email address.</p></li></ul></div><p style="margin-left: 80px"><span style="font-weight: bold; color: rgb(255,255,255); background-color: rgb(0,0,0)"><br />PHP:<br /></span><code><span style="color: rgb(0,0,0)"><font size="2"><font face="Courier"><span style="color: rgb(255,128,0)">/* get the action */ <br /></span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= @</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'action'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">]; <br /><br />if (isset(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'id'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">])) { <br /></font></span><span style="color: rgb(255,128,0)"><font face="Courier" size="2">&nbsp; &nbsp; /* the user has already made a request and been given an email ID */ <br />&nbsp;&nbsp;&nbsp;&nbsp;</font></span><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">try { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$email </span><span style="color: rgb(0,119,0)">= new </span><span style="color: rgb(0,0,187)">EmailValidator</span><span style="color: rgb(0,119,0)">((int)</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'id'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">]); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (isset(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'email'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">])) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span><font size="2"><font face="Courier"><span style="color: rgb(255,128,0)">&nbsp; &nbsp; /* a new email has been sent, so we must re-validate */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0,0,187)">&nbsp; &nbsp; $email</span><span style="color: rgb(0,119,0)">-&gt;</span><span style="color: rgb(0,0,187)">setEmail</span><span style="color: rgb(0,119,0)">(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'email'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">]); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= </span><span style="color: rgb(221,0,0)">'validate'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp; &nbsp; } catch (</span><span style="color: rgb(0,0,187)">EmailValidatorException $e</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (isset(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'email'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">])) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><font size="2"><font face="Courier"><span style="color: rgb(255,128,0)">/* the ID was invalid, but we have been sent an email address */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$email </span><span style="color: rgb(0,119,0)">= new </span><span style="color: rgb(0,0,187)">EmailValidator</span><span style="color: rgb(0,119,0)">(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'email'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">]); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= </span><span style="color: rgb(221,0,0)">'validate'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><font size="2"><font face="Courier"><span style="color: rgb(255,128,0)">/* an invalid ID was specified and no email address was given - we cannot do much */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= </span><span style="color: rgb(221,0,0)">'invalid'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp;&nbsp;} catch (</span><span style="color: rgb(0,0,187)">Exception $e</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= </span><span style="color: rgb(221,0,0)">'unknownerror'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">; <br />&nbsp;&nbsp;&nbsp;&nbsp;} <br />} else if (isset(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'email'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">])) { <br />&nbsp;&nbsp;&nbsp;&nbsp;try { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><font size="2"><font face="Courier"><span style="color: rgb(255,128,0)">/* load the new email into the validator */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$email </span><span style="color: rgb(0,119,0)">= new </span><span style="color: rgb(0,0,187)">EmailValidator</span><span style="color: rgb(0,119,0)">(</span><span style="color: rgb(0,0,187)">$_GET</span><span style="color: rgb(0,119,0)">[</span><span style="color: rgb(221,0,0)">'email'</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">]); <br />&nbsp;&nbsp;&nbsp;&nbsp;} catch (</span><span style="color: rgb(0,0,187)">Exception $e</span></font></font><font size="2"><font face="Courier"><span style="color: rgb(0,119,0)">) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= </span><span style="color: rgb(221,0,0)">'unknownerror'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">; <br />&nbsp;&nbsp;&nbsp;&nbsp;} <br />} else { <br />&nbsp;&nbsp;&nbsp;&nbsp;</font></span><font size="2"><font face="Courier"><span style="color: rgb(255,128,0)">/* no action sent &ndash; we cannot do much */ <br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0,0,187)">$action </span><span style="color: rgb(0,119,0)">= </span><span style="color: rgb(221,0,0)">'invalid'</span></font></font><span style="color: rgb(0,119,0)"><font face="Courier" size="2">; <br />}<br />&nbsp;</font></span></span></code></p><div class="articlePara" style="margin-left: 80px">Notice how we have overridden the action variable to re-validate the email address if an email address is sent as well as an ID (indicating that it has changed). We also override the action variable if an error occurs when attempting to create an instance of the EmailValidator object.</div><p style="margin-left: 80px">译文:</p><p style="margin-left: 80px">AJAX简介:</p><p style="margin-left: 80px">&nbsp;&nbsp;&nbsp; 在本系列文章的第一部分,我们了解了如何使用php5操纵和解析xml文件.本文将关注AJAX,一种热门并且非常有用的XML应用.</p><p style="margin-left: 80px">&nbsp;&nbsp;&nbsp; 首先,我们将会介绍AJAX以及学习怎样使用XMLHTTP对象为时下主流的WEB浏览器提供实时邮件验证表单.接着,我们将继续关于XML的话题并且介绍XSLT,我们要用他来把此前一篇文章中的XML库转换为有效的XHTML代码.</p><p style="margin-left: 80px">什么是AJAX?</p><p style="margin-left: 80px">如今,从管理用户图片到任务评定分配系统,存在着大量的可以做任何使用的WEB应用.这些应用大部分存在于三个部分:</p><p style="margin-left: 80px">后台终端部分,通常用来保存与应用相关的数据.后台终端包含处理数据更行,存取的逻辑,数据以服务器端代码的,sql和存储程序的形式出现.</p><p style="margin-left: 80px">中转终端,这是所有神奇产生的地方,通常在待验证的数据发送到前台终端之前对其进行转换,操作,存取和核对.</p><p style="margin-left: 80px">前台终端部分,用户同其进行交互.他通常包含很少的逻辑及简单的行文,它们像一台引擎,初始化同中转终端的交流.虽然前台终端涉及的应用逻辑很少,但是他可能是WEB应用中最重要的单个部分.设计的很糟糕并且难以使用的前台终端将使中转终端的所有神奇大打折扣.</p><p style="margin-left: 80px">在大多数的WEB应用中,基于中转终端的请求逻辑需要用户点击链接或者通过FORM表单提交数据,请求逻辑并不一定会改变呈现给用户的信息.这样一来就需要整个页面刷新,所有数据重新发送给用户.一个页面有大量的数据要刷新的话还可以,但是只有很少的或者没有数据要刷新那简直就是浪费了.</p><p style="margin-left: 80px"><img height="125" alt="" width="660" align="left" src="file:///C:/Documents%20and%20Settings/Administrator.2AF4C0A755F94A2/Local%20Settings/Temporary%20Internet%20Files/Content.IE5/XHNLA79T/webapp1%5B1%5D.gif" /></p><p style="margin-left: 80px">AJAX的原理就是当用户向服务器端请求部分应用,仅仅把用户请求的数据发送回去并且只更新需要更新的页面部分,而不是重载整个页面.</p><p style="margin-left: 80px">AJAX是异步JAVAscript和XML的缩写,他是Javascript代码在html页面中的一种应用,它使Javascript能够独立的向web服务器发送请求.在AJAX解决方案中,XML并不是必须的,在某些情况下它是完全不必要的.使用AJAX,前台终端可以分为两部分:处理页面外观的HTML和CSS以及AJAX引擎.</p><p style="margin-left: 80px"><img height="150" alt="" width="720" align="left" src="file:///C:/Documents%20and%20Settings/Administrator.2AF4C0A755F94A2/Local%20Settings/Temporary%20Internet%20Files/Content.IE5/XHNLA79T/webapp2%5B1%5D.gif" /></p><p style="margin-left: 80px">AJAX引擎用于初始化两条同服务器端交流的方式,一次作为对页面上用户行为的回应,这使得开发人员通过创建强大的事件驱动的WEB前台终端,可以扩展和增强WEB应用的可用性,就像在桌面应用领域我们所习惯的那样,回应几乎就是同时发生.</p><p style="margin-left: 80px">参考&lt;the ajax in action&gt;的第一章,你可以看到关于AJAX定义的更多细节以及它是如何在WEB设计领域中占据一席之地的.</p><p style="margin-left: 80px">用AJAX进行实时的EMAIL验证</p><p style="margin-left: 80px">现在我们即将进入AJAX世界:创建一个简单的应用--当电子邮件地址被填入表单即验证并核实用户电子邮件地址.预先了解HTML和Javascript知识对于学习本文有一定的好处,但是相对于机械的照抄(不是复制和粘贴)没有什么比你自己学习和设计解决方案更好的方式了.</p><p style="margin-left: 80px">一般来说,电子邮件的验证和核实在服务器上进行.验证通常包括语法检查或者发送一份带有链接及验证代码的电子邮件,一旦点击了该链接就可以证实邮件地址是真实且可用的.</p><p style="margin-left: 80px">我们的小型应用将在表单提交之前,或者更准确一点,在表单填入时进行上述的两种验证.这个特点对于需要花费几分钟来完成的表单来说特别的有用,它也可以扩展为在验证时包含一个代替明文代码的随机生成的图片.</p><p style="margin-left: 80px">为了使创建我们的小型AJAX应用更容易,我创建了一个电子邮件验证类,email_validtor.php提供了验证和核实电子邮件地址的必要工具.它使用SQLite数据库存储需要验证的电子邮件地址并且提供必要的方法检查邮件的语法,核实邮件的域名部分,同时向该邮件地址发送一个随机生成的验证代码.</p><p style="margin-left: 80px">这个类的源代码和文档可以从这个zip文件下载获得.</p><p style="margin-left: 80px">编写AJAX代码</p><p style="margin-left: 80px">记住这个事实是有用的,当在WEB应用中初次使用或者包含AJAX,代码的编写将会变的更加的复杂:</p><p style="margin-left: 80px">&nbsp;&nbsp;&nbsp; AJAX引擎和服务器端脚本需要同时理解请求和回应的环境背景.</p><p style="margin-left: 80px">&nbsp;&nbsp;&nbsp; 请求和回应在AJAX与服务器端脚本之间的顺序(如果重要的话)一定要弄清楚,因为它们并不能保证按照预定的顺序被接收.</p><p style="margin-left: 80px">&nbsp;&nbsp;&nbsp;&nbsp; 未完待续.......</p>]]></description>
	<pubDate>Wed, 17 Sep 2008 10:54:11 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=10</guid>

</item>
<item>
	<title>Using XML: A PHP Developer's Primer=&gt;操作XML:PHP开发人员入门&lt;第一部分&gt; 译文3</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=9</link>
	<description><![CDATA[<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;&nbsp; <a target="_self" href="http://www.7bing.org/showlog-8.html">&lt;接上篇&gt;</a></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;&nbsp; 这些只是<span lang="EN-US">Xpath的冰山一角.你可以用Xpath创建超级复杂的查询在你的文档中去寻找任何一种信息.我再次修改一下实例代码,你可以看看Xpath有多么的优雅.<o:p></o:p></span></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;<o:p></o:p></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-size: 10pt; background: black; color: white; font-family: Verdana; mso-bidi-font-family: Tahoma">PHP:</span></b><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><br /></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;$xml </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">simplexml_load_file</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">'xml/library.xml'</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br /></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br /></span><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;html&gt;&nbsp;</span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;head&gt; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;XML Library&lt;/title&gt; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/head&gt; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;body&gt; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">foreach(((array)</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">xpath</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">&quot;/library/books/book&quot;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">)) as </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">): </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">/* list categories */ </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">''</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">category </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">as </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) { </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">/* get the category with this ID */ </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">xpath</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">&quot;/library/categories/category[@cid='$category']&quot;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">.= (string) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">[</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">0</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">] . </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">', '</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">substr</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">0</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, -</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">2</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br /></span><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&nbsp;&nbsp;&nbsp;&nbsp; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">echo(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">title</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/h2&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;b&gt;Author:&lt;/b&gt;: </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">echo(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">author</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/p&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;b&gt;Categories: &lt;/b&gt;: </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">echo(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/p&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt; </code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">endforeach; </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br /></span><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/html&gt;<o:p></o:p></span></code></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&nbsp;<o:p></o:p></span></code></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体"><b><span lang="EN-US" style="mso-hansi-font-family: 宋体">DOM 和Xpath</span></b><span lang="EN-US" style="mso-hansi-font-family: 宋体"><o:p></o:p></span></font></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;<o:p></o:p></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span style="mso-hansi-font-family: 宋体"><font face="宋体">在<span lang="EN-US">DOM中为Xpath查询寻值需要创建一个DOMXpath对象.</span></font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"> evaluate()</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">函数返回一个</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">DOMElements</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">数组</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">:<o:p></o:p></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体"><span lang="EN-US" style="color: #0000bb">$xPath</span><span lang="EN-US" style="color: #007700"> = new </span><span lang="EN-US" style="color: #0000bb">DOMXPath</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #0000bb">$xml</span></font><font face="宋体"><span lang="EN-US" style="color: #007700">);<br /></span><span lang="EN-US" style="color: #0000bb">$xPath</span><span lang="EN-US" style="color: #007700">-&gt;</span><span lang="EN-US" style="color: #0000bb">evaluate</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">&quot;/library/books/book[title='Apache 2']&quot;</span><span lang="EN-US" style="color: #007700">);<o:p></o:p></span></font></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="color: #007700"><font face="宋体">&nbsp;<o:p></o:p></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span style="mso-hansi-font-family: 宋体"><font face="宋体">总结<span lang="EN-US"><o:p></o:p></span></font></span></b></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;<o:p></o:p></font></span></b></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span style="mso-hansi-font-family: 宋体"><font face="宋体">现在我们已经看到了<span lang="EN-US">PHP提供给我们的同XML交互的工具,我们已经武装完毕并且准备探究XML应用.在我的下篇文章中我们将会看到AJAX,并且展示像GOOGLE这样的网站是如何实现它的(接着,查询一下吧)<o:p></o:p></span></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;<o:p></o:p></font></span></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span style="mso-hansi-font-family: 宋体"><font face="宋体">有用的链接<span lang="EN-US"><o:p></o:p></span></font></span></b></p><p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="mso-hansi-font-family: 宋体"><font face="宋体">&nbsp;<o:p></o:p></font></span></b></p><p class="MsoNormal" style="background: white; margin: 18.75pt 1.5pt 0pt 171pt; text-indent: -18pt; text-align: left; mso-pagination: widow-orphan; mso-list: l2 level1 lfo5; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Symbol; mso-font-kerning: 0pt; mso-bidi-font-family: Tahoma">&middot;<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><a href="http://www.w3.org/TR/REC-xml/"><span style="font-size: 9pt"><font color="#244276">W3c XML Standard</font></span></a> </span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: Tahoma"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; margin: 0cm 1.5pt 0pt 171pt; text-indent: -18pt; mso-list: l2 level1 lfo5; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-margin-top-alt: auto"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Symbol; mso-bidi-font-family: Tahoma">&middot;<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><a href="http://www.w3.org/DOM/"><span style="font-size: 9pt"><font color="#244276">DOM API</font></span></a> <o:p></o:p></span></p><p class="MsoNormal" style="background: white; margin: 0cm 1.5pt 0pt 171pt; text-indent: -18pt; mso-list: l2 level1 lfo5; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-margin-top-alt: auto"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Symbol; mso-bidi-font-family: Tahoma">&middot;<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><a href="http://www.w3.org/TR/xpath"><span style="font-size: 9pt"><font color="#244276">W3c XPath Standard</font></span></a> <o:p></o:p></span></p><p class="MsoNormal" style="background: white; margin: 0cm 1.5pt 0pt 171pt; text-indent: -18pt; mso-list: l2 level1 lfo5; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-margin-top-alt: auto"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Symbol; mso-bidi-font-family: Tahoma">&middot;<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><a href="http://www.php.net/dom"><span style="font-size: 9pt"><font color="#244276">PHP DOM Documentation</font></span></a> <o:p></o:p></span></p><p><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-bidi-font-family: Tahoma; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><a href="http://www.php.net/simplexml"><span style="font-size: 9pt"><font color="#244276">PHP Simple XML Documentation</font></span></a></span></p>]]></description>
	<pubDate>Sun, 07 Sep 2008 15:09:46 +0800</pubDate>
	<author>我不叫大脸猫</author>
	<guid>http://www.7bing.org/?action=showlog&amp;gid=9</guid>

</item>
<item>
	<title>Using XML: A PHP Developer's Primer=&gt;操作XML:PHP开发人员入门&lt;第一部分&gt; 译文2</title>
	<link>http://www.7bing.org/?action=showlog&amp;gid=8</link>
	<description><![CDATA[<p>&nbsp;文章太长了,我不得不把文章截了又截,汗一个.这个程序的文本处理能力实在是太差了.</p>
<p><a target="_self" href="http://www.7bing.org/showlog-7.html">&lt;接上篇&gt;</a></p>
<pre style="background: white; margin-left: 135pt"><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">xml-&gt;save</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'xml/library.xml'</span><span lang="EN-US" style="color: #007700">);</span><span lang="EN-US"> <span style="color: #ff8000"><o:p></o:p></span></span></font></font></pre>
<pre style="background: white; margin-left: 135pt"><span lang="EN-US" style="color: #ff8000"><font face="Courier" size="2">// save the whole file</font></span><span lang="EN-US"><br />
<font size="2"><font face="Courier"><span style="color: #0000bb">$categories</span> <span style="color: #007700">=</span> <span style="color: #0000bb">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000bb">saveXML</span><span style="color: #007700">(</span><span style="color: #0000bb">$XMLCategories</span><span style="color: #007700">);</span> <span style="color: #ff8000"><o:p></o:p></span></font></font></span></pre>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="color: #ff8000"><font face="宋体">// return a string containing just the categories<o:p></o:p></font></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="color: #ff8000"><font face="宋体">&nbsp;<o:p></o:p></font></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体">以下是用<span lang="EN-US">Javascript写成的代码,它展示了在DOM程式化代码中为另一种语言创建端口是多么的容易:</span></font></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="宋体">&nbsp;<o:p></o:p></font></span></p>
<p class="MsoNormal" style="background: white; margin: 0cm 0cm 0pt 135pt; text-align: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: Tahoma"><br />
<b><span style="background: black; color: white">Javascript:</span></b></span><span lang="EN-US" style="font-size: 9pt; font-family: Tahoma; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<pre style="background: white; margin-left: 135pt"><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">function </span><span lang="EN-US" style="color: #0000bb">doXML</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">()<br />
{<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #ff8000">/* first to create a list of categories */</span></font></font><span lang="EN-US" style="color: #007700"><br />
<font size="2"><font face="Courier"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>var </font></font></span><span lang="EN-US" style="color: #0000bb"><font face="Courier" size="2">categories</font></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700"> = Array();<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>var </span><span lang="EN-US" style="color: #0000bb">XMLCategories</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">xml.getElementsByTagName</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'categories'</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">)[0];<br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>var </span><span lang="EN-US" style="color: #0000bb">theCategories</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">XMLCategories.getElementsByTagName</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'category'</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>for (var </span><span lang="EN-US" style="color: #0000bb">i</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">0</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #0000bb">i</span><span lang="EN-US" style="color: #007700"> &lt; </span><span lang="EN-US" style="color: #0000bb">theCategories.length</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #0000bb">i</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">++) {<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #ff8000">/* notice how we get attributes */</span></font></font><span lang="EN-US" style="color: #007700"><br />
<font size="2"><font face="Courier"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>var </font></font></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">cid</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">theCategories[i]</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">getAttribute</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'cid'</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">categories[cid]</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">theCategories[i]</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">firstChild</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">nodeValue</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">;<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}<br />
<span style="mso-tab-count: 1"> </span><br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>var </span><span lang="EN-US" style="color: #0000bb">theBooks</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">xml</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">getElementsByTagName</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'book'</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">); <br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>for(var </span><span lang="EN-US" style="color: #0000bb">i</span><span lang="EN-US" style="color: #007700"> =</span><span lang="EN-US" style="color: #0000bb"> 0</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #0000bb">i</span><span lang="EN-US" style="color: #007700"> &lt; </span><span lang="EN-US" style="color: #0000bb">theBooks</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">length</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #0000bb">i</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">++) {<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>var </span><span lang="EN-US" style="color: #0000bb">book</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">theBooks[i]</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">;<br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #ff8000">/* find the title */</span></font></font><span lang="EN-US" style="color: #007700"><br />
<font size="2"><font face="Courier"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>var </font></font></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">title</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">book</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">getElementsByTagName</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'title'</span><span lang="EN-US" style="color: #007700">)</span><span lang="EN-US" style="color: #0000bb">[0]</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">firstChild</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">nodeValue</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">;<br />
<br />
<span style="mso-tab-count: 1"> </span></span><span lang="EN-US" style="color: #ff8000">/* find the author - for simplicity we assume there is only one */</span></font></font><span lang="EN-US" style="color: #007700"><br />
<font size="2"><font face="Courier"><span style="mso-tab-count: 1"> </span>var </font></font></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">author</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">book</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">getElementsByTagName</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'author'</span><span lang="EN-US" style="color: #007700">)</span><span lang="EN-US" style="color: #0000bb">[0]</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">firstChild</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">nodeValue</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">;<br />
<br />
<span style="mso-tab-count: 1"> </span></span><span lang="EN-US" style="color: #ff8000">/* list categories */ </span></font></font><span lang="EN-US" style="color: #007700"><br />
<font size="2"><font face="Courier"><span style="mso-tab-count: 1"> </span>var </font></font></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">bookCategories</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">book</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">getElementsByTagName</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">'category'</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>var </span><span lang="EN-US" style="color: #0000bb">catList</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #dd0000">''</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">;<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>for(var </span><span lang="EN-US" style="color: #0000bb">j</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">0</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #0000bb">j</span><span lang="EN-US" style="color: #007700"> &lt; </span><span lang="EN-US" style="color: #0000bb">bookCategories</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">length</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #0000bb">j</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">++) {<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">catList</span><span lang="EN-US" style="color: #007700"> += </span><span lang="EN-US" style="color: #0000bb">categories[bookCategories[j]</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">firstChild</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">nodeValue</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">] + ', ';<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">catList</span><span lang="EN-US" style="color: #007700"> = </span><span lang="EN-US" style="color: #0000bb">catList</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">substring</span><span lang="EN-US" style="color: #007700">(0, </span><span lang="EN-US" style="color: #0000bb">catList</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">length</span><span lang="EN-US" style="color: #007700"> -</span><span lang="EN-US" style="color: #0000bb">2</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">document</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">open</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">();<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">document</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">write</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">&quot;&lt;h2&gt;&quot;</span><span lang="EN-US" style="color: #007700"> + </span><span lang="EN-US" style="color: #0000bb">title</span><span lang="EN-US" style="color: #007700"> + </span><span lang="EN-US" style="color: #dd0000">&quot;&lt;/h2&gt;&quot;</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">document</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">write</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">&quot;&lt;p&gt;&lt;b&gt;Author:&lt;/b&gt;: &quot;</span><span lang="EN-US" style="color: #007700"> + </span><span lang="EN-US" style="color: #0000bb">author </span><span lang="EN-US" style="color: #007700">+ </span><span lang="EN-US" style="color: #dd0000">&quot;&lt;/p&gt;&quot;</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">document</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">write</span><span lang="EN-US" style="color: #007700">(</span><span lang="EN-US" style="color: #dd0000">&quot;&lt;p&gt;&lt;b&gt;Categories: &lt;/b&gt;: &quot;</span><span lang="EN-US" style="color: #007700"> + </span><span lang="EN-US" style="color: #0000bb">catList</span><span lang="EN-US" style="color: #007700"> + </span><span lang="EN-US" style="color: #dd0000">&quot;&lt;/p&gt;&quot;</span></font></font><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">);<br />
<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="color: #0000bb">document</span><span lang="EN-US" style="color: #007700">.</span><span lang="EN-US" style="color: #0000bb">close</span></font></font><span lang="EN-US" style="color: #007700"><font size="2"><font face="Courier">();<br />
}<o:p></o:p></font></font></span></pre>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US"><font face="宋体">Simple XML<o:p></o:p></font></span></b></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="宋体">&nbsp;<o:p></o:p></font></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="宋体">Simple XML真的很简单.它能够存取XML,它的元素和属性能够使用对象和数组存取方法.用它写成的例子也很简单:</font></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体"><b><span lang="EN-US">Elements</span></b><span lang="EN-US">-它们代表了</span></font><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">SimpleXMLElement</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">对象的单个属性</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">.</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">在这里不止一个元素作为文档或者元素的子集存在</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">,</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">每一个元素都可以通过数组的索引符号存取</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">.</span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="宋体">&nbsp;<o:p></o:p></font></span></p>
<pre style="background: white; margin: 18.75pt 1.5pt 0pt 171pt; text-indent: -18pt; mso-list: l4 level1 lfo1"><span lang="EN-US" style="color: #007700; font-family: Symbol"><font size="2">&middot;</font><span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">$xml</span><span lang="EN-US" style="color: #007700">-&gt;</span><span lang="EN-US" style="color: #0000bb">books</span><span lang="EN-US" style="color: #007700">; </span><span lang="EN-US" style="color: #ff8000">// returns the element &quot;books&quot;</span></font></font><span lang="EN-US" style="color: #007700"><br />
</span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">$xml</span><span lang="EN-US" style="color: #007700">-&gt;</span><span lang="EN-US" style="color: #0000bb">books</span><span lang="EN-US" style="color: #007700">-&gt;</span><span lang="EN-US" style="color: #0000bb">book</span><span lang="EN-US" style="color: #007700">[</span><span lang="EN-US" style="color: #0000bb">0</span><span lang="EN-US" style="color: #007700">]; </span><span lang="EN-US" style="color: #ff8000">// returns the first book inside the books element</span><span lang="EN-US" style="color: #007700"><o:p></o:p></span></font></font></pre>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体"><b><span lang="EN-US">Attributes-</span></b>元素的属性通过关联数组的符号存取和设定<span lang="EN-US">,在此处索引同属性的名称相同.</span></font></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="宋体">&nbsp;<o:p></o:p></font></span></p>
<pre style="background: white; margin: 18.75pt 1.5pt 0pt 171pt; text-indent: -18pt; mso-list: l1 level1 lfo2"><span lang="EN-US" style="color: #007700; font-family: Symbol"><font size="2">&middot;</font><span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #0000bb">$category</span><span lang="EN-US" style="color: #007700">[</span><span lang="EN-US" style="color: #dd0000">'cid'</span><span lang="EN-US" style="color: #007700">]; </span><span lang="EN-US" style="color: #ff8000">// returns the value of the cid attribute</span><span lang="EN-US" style="color: #007700"><o:p></o:p></span></font></font></pre>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体"><b><span lang="EN-US">Element Data-</span></b>检索元素内部的文本数据需要把数据转换为恰当的字符串<span lang="EN-US">,并使用(字符串)或输出:使用print或者echo.如果元素包含一个以上的文本节点,它们会被连接起来以保证能够被找到.(译者注:这里的连接应该是指使用<span style="color: #007700">-&gt;</span>将节点连接以表示从属关系)</span></font></p>
<pre style="background: white; margin: 18.75pt 1.5pt 0pt 171pt; text-indent: -18pt; mso-list: l0 level1 lfo3"><span lang="EN-US" style="color: #007700; font-family: Symbol"><font size="2">&middot;</font><span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><font size="2"><font face="Courier"><span lang="EN-US" style="color: #007700">echo (</span><span lang="EN-US" style="color: #0000bb">$xml</span><span lang="EN-US" style="color: #007700">-&gt;</span><span lang="EN-US" style="color: #0000bb">books</span><span lang="EN-US" style="color: #007700">-&gt;</span><span lang="EN-US" style="color: #0000bb">book</span><span lang="EN-US" style="color: #007700">[</span><span lang="EN-US" style="color: #0000bb">0</span><span lang="EN-US" style="color: #007700">]-&gt;</span><span lang="EN-US" style="color: #0000bb">title</span><span lang="EN-US" style="color: #007700">); </span><span lang="EN-US" style="color: #ff8000">// displays the title of the first book</span><span lang="EN-US" style="color: #007700"><o:p></o:p></span></font></font></pre>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体">这里有一个原创的关于转换<span lang="EN-US">SIMPLE XML的例子.为了加载XML文件,我们使用</span></font><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">simplexml_load_file()</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">函数</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">.</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">它解析</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">XML</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">文件并且把它加载进一个</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">SimpleXMLElement</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">对象</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">:<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">&nbsp;<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-size: 10pt; background: black; color: white; font-family: Verdana; mso-bidi-font-family: Tahoma">PHP:</span></b><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><br />
</span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;$xml </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">simplexml_load_file</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">'xml/library.xml'</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">/* load a list of categories into an array */ </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$categories </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= array(); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;foreach(</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">categories</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">category </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">as </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) { </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$categories</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">[(string) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">[</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">'cid'</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">]] = (string) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;} </code><br />
<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp; </code><br />
</span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br />
</span><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;html&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;head&gt; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;XML Library&lt;/title&gt; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/head&gt; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;body&gt; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">foreach(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">books</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">book </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">as </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">): </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">/* list categories */ </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">''</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">category </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">as </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) { </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">.= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$categories</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">[((string) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">)] . </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">', '</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">substr</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">0</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, -</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">2</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br />
</span><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&nbsp;&nbsp;&nbsp;&nbsp; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">echo(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">title</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/h2&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;b&gt;Author:&lt;/b&gt;: </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">echo(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$book</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">author</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/p&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;b&gt;Categories: &lt;/b&gt;: </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">echo(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catList</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/p&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">&lt;?php </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">endforeach; </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">?&gt; </span></code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier; mso-fareast-font-family: 黑体"><br />
</span><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&lt;/html&gt;<o:p></o:p></span></code></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><code><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Courier">&nbsp;<o:p></o:p></span></code></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><font face="宋体">修改<span lang="EN-US">XML<o:p></o:p></span></font></b></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US"><font face="宋体">&nbsp;<o:p></o:p></font></span></b></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体">虽然文本数据和属性值能够通过<span lang="EN-US">SIMPLE XML来设置,但是新的数据却不能创建.不过,SIMPLE XML提供了一个转换</span></font><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">DomElement</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">对象和</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">SimpleXMLElement</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">对象的方法</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">.</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">我修改了</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">addCategory()</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">函数</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">,</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">用它来展示</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">simplexml_import_dom()</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">函数是如何被用来添加一个分类并且把文档转换回</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">SIMPLE XML</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">格式</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">:<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">&nbsp;<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-size: 10pt; background: black; color: white; font-family: Verdana; mso-bidi-font-family: Tahoma">PHP:</span></b><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"><br />
</span><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">function </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">addCategory</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">SimpleXMLElement </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">&amp;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$sXML</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catID</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catName</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">) </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>{ </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= new </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">DOMDocument</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">loadXML</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$sXML</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">asXML</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">()); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catName </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">createTextNode</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catName</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">// create a node to hold the text </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">createElement</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">'category'</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">// create a category element </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">appendChild</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catName</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">// add the text to the category element </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">setAttribute</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">'cid'</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">, </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$catID</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">// set the category id </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp; </code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$XMLCategories </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">getElementsByTagName</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #dd0000; font-family: Courier">'categories'</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">)-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">item</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">0</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$XMLCategories</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">-&gt;</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">appendChild</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$category</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier">// add the new category </span></code><span lang="EN-US" style="font-size: 10pt; color: #ff8000; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;</code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$sXML </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">= </span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">simplexml_import_dom</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">(</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$xml</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">); </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;return </code></span><code><span lang="EN-US" style="font-size: 10pt; color: #0000bb; font-family: Courier">$sXML</span></code><code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier">; </span></code><span lang="EN-US" style="font-size: 10pt; color: #007700; font-family: Courier; mso-fareast-font-family: 黑体"><br />
<code>}<o:p></o:p></code></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><font face="宋体">很明显<span lang="EN-US">,</span></font><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"> SimpleXMLElement</span><font face="宋体"><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma">对象中的</span><span lang="EN-US">asXML()函数能够检索XML字符串并且保存为文件.</span></font></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="宋体">&nbsp;<o:p></o:p></font></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-size: 9pt; font-family: Tahoma">XPath<o:p></o:p></span></b></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-size: 9pt; font-family: Tahoma">&nbsp;<o:p></o:p></span></b></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-bidi-font-size: 9.0pt; mso-hansi-font-family: 宋体; mso-bidi-font-family: Tahoma"><font face="宋体">Xpath无疑是XML这个皇冠上的钻石.Xpath使你能够使用类似于SQL一样的查询在XML文档中寻找具体的信息.</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma"> DOM </span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">和</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">SimpleXML</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">都是为了支持</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">Xpath</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">为创建</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">,</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">后者</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">,</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">像</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">SQL</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">一样可以在</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">XML</span><span style="font-size: 10pt; color: black; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: Tahoma"><font face="宋体">文档中寻找任何你想要的东西</font></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">.<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; margin: 18.75pt 1.5pt 0pt 171pt; text-indent: -18pt; text-align: left; mso-pagination: widow-orphan; mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Symbol; mso-font-kerning: 0pt; mso-bidi-font-family: Tahoma">&middot;<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span class="incsmall"><b><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">//category</span></b></span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: Verdana; mso-bidi-font-family: Tahoma">