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

<channel>
	<title>Becomin&#039; Charles &#187; code</title>
	<atom:link href="http://sexywp.com/tags/code/feed" rel="self" type="application/rss+xml" />
	<link>http://sexywp.com</link>
	<description>Building another myself~~</description>
	<lastBuildDate>Fri, 27 Jan 2012 16:00:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[心得]：在thickbox退出时执行动作</title>
		<link>http://sexywp.com/thickbox-tips.htm</link>
		<comments>http://sexywp.com/thickbox-tips.htm#comments</comments>
		<pubDate>Tue, 23 Feb 2010 05:01:46 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=366</guid>
		<description><![CDATA[thickbox是jQuery的插件，可以在页面上显示一个模拟出来的窗体，可以是对话框，AJAX内容，或者仅仅用来展示图片。其使用非常方便，只要在页面中引入了thickbox.js和thickbox.css，就可以通过设定A，INPUT，AREA元素的href或者alt属性，就可以使得其功能得以实现。具体的文档，可以参见这里。

WordPress在脚本库中添加了thickbox的脚本，调用起来格外地简单。所以我就选用了这个作为WP插件后台管理界面中，用户交互对话框的解决方案。在这里，介绍一点我在开发过程中的经验。如果需要在thickbox弹出窗体退出时执行一些动作，那么比较好的办法是向#TB_Window的unload事件绑定动作，thickbox在退出时会触发该动作，该动作是在tb_remove()函数中触发的。

<span class="readmore"><a href="http://sexywp.com/thickbox-tips.htm" title="[心得]：在thickbox退出时执行动作">Keep Reading --- 380 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">jQuery里面用到“打包盒”</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Ftemplate-tags-usage.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Template Tags（模板标签）使用指南</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Freplace-the-wp-js-lib-by-googleapi.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用Google AJAX Libraries API替换WordPress自带的js库</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">也说用jQuery改进WP评论表单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fshare-this-jquery.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件修改：Share This (jQuery)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>thickbox是jQuery的插件，可以在页面上显示一个模拟出来的窗体，可以是对话框，AJAX内容，或者仅仅用来展示图片。其使用非常方便，只要在页面中引入了thickbox.js和thickbox.css，就可以通过设定A，INPUT，AREA元素的href或者alt属性，就可以使得其功能得以实现。具体的文档，可以参见<a href="http://jquery.com/demo/thickbox/">这里</a>。</p>
<p>WordPress在脚本库中添加了thickbox的脚本，调用起来格外地简单。所以我就选用了这个作为WP插件后台管理界面中，用户交互对话框的解决方案。在这里，介绍一点我在开发过程中的经验。如果需要在thickbox弹出窗体退出时执行一些动作，那么比较好的办法是向#TB_Window的unload事件绑定动作，thickbox在退出时会触发该动作，该动作是在tb_remove()函数中触发的。</p>
<p>向这个事件绑定动作的方法有点小窍门，因为页面初始化完成后，文档Dom中并不包含#TB_Window元素，只有在thickbox被触发后，该元素才添加到Dom中。经过阅读源代码后，我发现，可以在触发thickbox的对象的blur事件中，向#TB_Window的unload事件绑定动作。示例代码如下：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Olive;">&lt;</span><span style="color: Green;">a</span><span style="color: Gray;"> </span><span style="color: #00008b;">id</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">open-dialog</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> </span><span style="color: #00008b;">href</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">#TB_inline?height=300&amp;width=400&amp;inlineID=dialog</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">Click Here</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">a</span><span style="color: Olive;">&gt;</span></li></ol></div></div>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">$</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">#open-dialog</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">blur</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; $</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">#TB_Window</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">unload</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">do something here</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; </span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li></ol></div></div>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">jQuery里面用到“打包盒”</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Ftemplate-tags-usage.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Template Tags（模板标签）使用指南</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Freplace-the-wp-js-lib-by-googleapi.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用Google AJAX Libraries API替换WordPress自带的js库</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">也说用jQuery改进WP评论表单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fshare-this-jquery.htm&from=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件修改：Share This (jQuery)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/code" title="code" rel="tag">code</a>, <a href="http://sexywp.com/tags/develop" title="develop" rel="tag">develop</a>, <a href="http://sexywp.com/tags/jquery" title="jQuery" rel="tag">jQuery</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/thickbox-tips.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java的开源XML工具包dom4j</title>
		<link>http://sexywp.com/dom4j-xml-toolkit-java.htm</link>
		<comments>http://sexywp.com/dom4j-xml-toolkit-java.htm#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:12:59 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code examples]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=310</guid>
		<description><![CDATA[dom4j是一个使用简便的开源类库，专门用来在Java平台上处理XML，XPath和XSLT，该类库使用了Java Collections Framework，完全支持DOM，SAX和JAXP。

dom4j为一个XML文档在内存中创建了一个树对象模型。 它提供了一组强大易用的API，通过XPath和XSLT来处理、操纵或者遍历XML文件，此外其中还集成了SAX、JAXP和DOM。

为了提供高度可配置的实现策略，dom4j基于接口设计。只需要提供一个DocumentFactory实现，您就可以创建您自己的XML树实现。这种设计，使得在扩展dom4j以定制您需要的特性时，能非常简单地重用dom4j的代码。

本文档将通过代码实例的方式为您提供一个dom4j的实践指南。在实验室项目中，这个开源工具包给我的工作带来了很大的便利，在这篇文章中，我将对项目中用到dom4j完成的任务做个总结，以期和互联网上的众多文档能够互相补充。

<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="如何让Java程序定时运行" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-java-task-scheduled-excecute.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/23/9225479.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何让Java程序定时运行</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在Hibernate里配置Proxool连接池" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在Hibernate里配置Proxool连接池</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="怎么觉得Python这么混乱呢" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么觉得Python这么混乱呢</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="天啊！Google Code中文版……" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fgoogle-code.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">天啊！Google Code中文版……</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; margin-left: 0px; margin-right: 0px" alt="The hierarchy of the interfaces in dom4j libaray" src="http://lh6.ggpht.com/_QYicOeu89Bk/SafPc8W7V6I/AAAAAAAABJo/pe3JBdV_QJg/s400/dom4j-interface-hierarchy.png" align="left"></p>
<p><strong>dom4j</strong>是一个使用简便的开源类库，专门用来在Java平台上处理<abbr title="eXtensible Markup Language">XML</abbr>，<abbr title="XML Path Language">XPath</abbr>和<abbr title="eXtensible Stylesheet Language Transformation">XSLT</abbr>，该类库使用了Java Collections Framework，完全支持<abbr title="Document Object Model">DOM</abbr>，<abbr title="Simple API for XML">SAX</abbr>和<abbr title="Java API for XML Processing">JAXP</abbr>。</p>
<p><strong>dom4j</strong>为一个XML文档在内存中创建了一个树对象模型。 它提供了一组强大易用的API，通过XPath和XSLT来处理、操纵或者遍历XML文件，此外其中还集成了SAX、JAXP和DOM。</p>
<p>为了提供高度可配置的实现策略，<strong>dom4j</strong>基于接口设计。只需要提供一个DocumentFactory实现，您就可以创建您自己的XML树实现。这种设计，使得在扩展dom4j以定制您需要的特性时，能非常简单地重用dom4j的代码。</p>
<p>本文档将通过代码实例的方式为您提供一个dom4j的实践指南。在实验室项目中，这个开源工具包给我的工作带来了很大的便利，在这篇文章中，我将对项目中用到dom4j完成的任务做个总结，以期和互联网上的众多文档能够互相补充。</p>
</p>
<p><span id="more-310"></span>
</p>
<h3>读取XML文件</h3>
<p>一般性地读取XML文件，在dom4j中操作起来将非常简单。</p>
</p>
<pre><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> readXMLSimple(File file) <span style="color: #0000ff">throws</span> DocumentException{
    <span style="color: #008000">//使用SAXReader读取XML文件</span>
    SAXReader sr = <span style="color: #0000ff">new</span> SAXReader();
    Document doc = sr.read(file);

    <span style="color: #008000">//使用XPath遍历一个XML文件的结点</span>
    Element root = doc.getRootElement();
    List entryList1 = root.selectNodes("<span style="color: #8b0000">entry</span>");
    <span style="color: #008000">//或者</span>
    List entryList2 = doc.selectNodes("<span style="color: #8b0000">/feed/entry</span>");
}</pre>
<p>&nbsp;</p>
<h3>创建一个XML文档并记录到磁盘上</h3>
<p>创建一个XML文件，并将其写到磁盘上，也可以使用非常简介的代码来完成，假设我们将上一个代码范例中得到的entry节点的列表，插入到一个新建的XML文档中，然后使用优美的缩进格式保存在磁盘上，我们可以像下面这样编码：</p>
<pre><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> createXMLSimple(List entries, File f)
        <span style="color: #0000ff">throws</span> FileNotFoundException,
               UnsupportedEncodingException,
               IOException{
    Document doc = DocumentHelper.createDocument();
    doc.addElement("<span style="color: #8b0000">feed</span>");
    Element root = doc.getRootElement();
    Iterator i = entries.iterator();
    <span style="color: #0000ff">while</span>(i.hasNext()){
       <span style="color: #008000">//从别的Dom中得到的Element都有其本身</span>
        <span style="color: #008000">//的root，所以必须创建副本才能插入另一个doc内</span>
        root.add(((Element)i.next()).createCopy());
    }
    FileOutputStream os = <span style="color: #0000ff">new</span> FileOutputStream(f);
    OutputFormat of = OutputFormat.createPrettyPrint();
    XMLWriter xmlw = <span style="color: #0000ff">new</span> XMLWriter(os,of);
    xmlw.write(doc);
}</pre>
<p>&nbsp;</p>
<h3>读取一个根节点带有默认Namespace的XML</h3>
<p>如果我们刚才的代码范例读取的是符合Atom1.0标准的Feed，那么，根节点带有default namespace的http://www.w3.org/2005/Atom。读取这样的XML文档稍微有点麻烦，网上的代码很多，但是很多都不好用，我总结下来，基本上没有办法像你想的那么干净。</p>
<pre><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> treatDefaultNamespace(File f)
        <span style="color: #0000ff">throws</span> DocumentException{
    SAXReader sr = <span style="color: #0000ff">new</span> SAXReader();
    Map ns = <span style="color: #0000ff">new</span> HashMap();
    ns.put("<span style="color: #8b0000">atom</span>", "<span style="color: #8b0000">http://www.w3.org/2005/Atom</span>");
    sr.getDocumentFactory().setXPathNamespaceURIs(ns);
    <span style="color: #008000">//Element接口支持迭代器，在这里顺便展示一下</span>
    Element root = sr.read(f).getRootElement();
    Iterator i = root.elementIterator();
    <span style="color: #0000ff">while</span>(i.hasNext()){
        Element e = (Element) i.next();
        <span style="color: #008000">//一旦指定了Namespace，则使用XPath的时候必须带上</span>
         <span style="color: #008000">//即便是默认的Namespace也一样，不过前面那个名字</span>
         <span style="color: #008000">//可以尽可能写得短，编码的时候方便，比如改成a</span>
        String title = e.selectSingleNode("<span style="color: #8b0000">atom:title</span>").getText();
        System.out.println(title);
    }
}</pre>
<p>&nbsp;</p>
<h3>创建一个根节点带有默认Namespace的XML</h3>
<p>创建一个带有default namespace的XML的方法，相当的tricky，因为你创建一个Element的方法有很多种，可以通过add方法，默认的建，也可以使用DocumentHelper对象来创建，不过，每种方法给你的结果都不同，往往让你大吃一惊。其他的那些方法，和得到的多种结果，大家可以在网上看，很多。我就提供一个能创建“干净”的XML的代码范例。</p>
<pre><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> createXMLWithDefaultNamespace(List entries){
    Document d = DocumentHelper.createDocument();
    d.addElement("<span style="color: #8b0000">feed</span>","<span style="color: #8b0000">http://www.w3.org/2005/Atom</span>");
    Element root = d.getRootElement();
    <span style="color: #008000">//省略迭代entries代码</span>
    root.addElement("<span style="color: #8b0000">title</span>").add(DocumentHelper.createCDATA(title));
    root.addElement("<span style="color: #8b0000">id</span>").add(DocumentHelper.createText(guid));
    root.addElement("<span style="color: #8b0000">category</span>").add(DocumentHelper.createText(category));
    root.addElement("<span style="color: #8b0000">link</span>").add(DocumentHelper.createText(permalink));
    root.addElement("<span style="color: #8b0000">updated</span>").add(DocumentHelper.createText(updated));
}</pre>
<p>&nbsp;</p>
<p>最后，罗列一下上文中用到的所有对象所在的包，没有列出的在J2SE内。</p>
<pre><span style="color: #0000ff">import</span> org.dom4j.Document;
<span style="color: #0000ff">import</span> org.dom4j.DocumentException;
<span style="color: #0000ff">import</span> org.dom4j.DocumentHelper;
<span style="color: #0000ff">import</span> org.dom4j.Element;
<span style="color: #0000ff">import</span> org.dom4j.io.OutputFormat;
<span style="color: #0000ff">import</span> org.dom4j.io.SAXReader;
<span style="color: #0000ff">import</span> org.dom4j.io.XMLWriter;</pre>
<h3>参考文章</h3>
<p>IBM Developer Works: <a href="http://www.ibm.com/developerworks/cn/xml/x-dom4j.html">使用 dom4j 解析 XML—使用 domj4 API 创建与修改 XML 文档</a></p>
<p><a href="http://www.dom4j.org/">dom4j官方网站</a></p>
<p><a href="http://www.dom4j.org/dom4j-1.6.1/apidocs/">dom4j的javadoc文档</a></p>
<p><a href="http://zhangjiansheng.blogspot.com/2007/11/dom4jnamespace.html">dom4j两种创建namespace的方法的差异! 07-11-30</a></p>
<p>dom4j Cookbook</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="如何让Java程序定时运行" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-java-task-scheduled-excecute.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/23/9225479.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何让Java程序定时运行</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在Hibernate里配置Proxool连接池" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在Hibernate里配置Proxool连接池</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="怎么觉得Python这么混乱呢" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么觉得Python这么混乱呢</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="天啊！Google Code中文版……" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fgoogle-code.htm&from=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">天啊！Google Code中文版……</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/code" title="code" rel="tag">code</a>, <a href="http://sexywp.com/tags/code-examples" title="code examples" rel="tag">code examples</a>, <a href="http://sexywp.com/tags/java" title="java" rel="tag">java</a>, <a href="http://sexywp.com/tags/tools" title="tools" rel="tag">tools</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/dom4j-xml-toolkit-java.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>也说用jQuery改进WP评论表单</title>
		<link>http://sexywp.com/progress-enhancement-of-comment-form.htm</link>
		<comments>http://sexywp.com/progress-enhancement-of-comment-form.htm#comments</comments>
		<pubDate>Fri, 14 Nov 2008 13:49:28 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[my works]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/?p=263</guid>
		<description><![CDATA[浏览WordPress博客的用户如果启用了Cookie，在发表评论后，信息会被记录在Cookie里，这样，下次登录同一个博客发表评论时，WordPress会为用户自动填写评论表单。可以说，这是一个十分贴心的设计。本文中，将介绍如何使用jQuery，来做到更进一步。

如果用户的信息已经存在了，那么就帮他填好，如果已经填好了，就可以把表单也隐藏起来，并且显示一句欢迎语。不得不说，这个想法非常的有趣，所以，我决定自己来做一下。

第一次看到这个功能是在stephen的博客，然后从他的博客，我链接到了xiaorsz写的文章，然后看到了mg12的文章，再然后是xiaorsz使用jQuery的改进版本。

<span class="readmore"><a href="http://sexywp.com/progress-enhancement-of-comment-form.htm" title="也说用jQuery改进WP评论表单">Keep Reading --- 802 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fshare-this-jquery.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件修改：Share This (jQuery)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwp-kit-cn.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件：WP Kit CN</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">jQuery里面用到“打包盒”</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwp-plugins-cformsii-intro.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件介绍：cformsII 及其汉化包</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwordpress-theme-googlecode.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress主题：GoogleCode</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>浏览WordPress博客的用户如果启用了Cookie，在发表评论后，信息会被记录在Cookie里，这样，下次登录同一个博客发表评论时，WordPress会为用户自动填写评论表单。可以说，这是一个十分贴心的设计。本文中，将介绍如何使用jQuery，来做到更进一步。</p>
<p><span id="more-263"></span>如果用户的信息已经存在了，那么就帮他填好，如果已经填好了，就可以把表单也隐藏起来，并且显示一句欢迎语。不得不说，这个想法非常的有趣，所以，我决定自己来做一下。</p>
<p>第一次看到这个功能是在<a href="http://www.caxblog.com/2008/11/597.html">stephen的博客</a>，然后从他的博客，我链接到了<a href="http://www.xiaorsz.cn/2008/10/hide-input-box-improve-user-experience/">xiaorsz写的文章</a>，然后看到了<a href="http://www.neoease.com/wordpress-guest-post/">mg12的文章</a>，再然后是<a href="http://www.xiaorsz.cn/2008/11/hide-input-box-jquery/">xiaorsz使用jQuery的改进版本</a>。</p>
<p>上述几篇文章已经对这个问题阐述得非常详细了，虽然说实现细节有所不同，但是基本原理是相同的。</p>
<p>1. 首先，读写Cookie这部分工作，WordPress已经帮我们做好了，基本上不用我们操心，也即如果用户发表过评论，则comment_author变量不为空，并且会自动填写到Comment Form的author输入框中。</p>
<p>2. 然后，我们用一段代码来隐藏昵称，邮件，网站三个输入框。</p>
<p>3. 最后，我们加上一句欢迎语，并且加上能够展开输入框的按钮。</p>
<p>我觉得这样一个小任务，使用jQuery来实现，简直再好也不过了，能够非常好的体现出progress enhancement的精神，所以说，我非要亲手实践一下，过过瘾。</p>
<p>我们看到，如果我们什么也不做，就仅有步骤1所表述的功能，自动填写Comment Form这样一个功能本身就是可用的，只不过不是那么漂亮，那么好玩而已！</p>
<p>接着，如果用户浏览器启用了javascript支持，并且，他正确下载了jQuery和页面代码，那么该用户可以得到步骤2，3提供的功能。也就是说，步骤2，3和javascript支持是并存的。</p>
<p>好了，分析结束，讲讲我的实现。因为是增强页面功能，所以，我就不打算去动原来的页面模板文件了。昵称、邮件和网址输入域，各自都有自己的id（分别是author，email和url），对于jQuery来说，这已经非常足够了，所以模板文件没什么需要改动的。只要创建一个js文件，写好上面的功能，链接进去就ok了。</p>
<p>下面是代码：</p>
<div class="hl-surround"><div class="hl-main"><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: Teal;">document</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">ready</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">var</span><span style="color: Gray;"> $</span><span style="color: Blue;">author</span><span style="color: Gray;"> = </span><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">#author</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">var</span><span style="color: Gray;"> $</span><span style="color: Blue;">author_email</span><span style="color: Gray;"> = </span><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">#email</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">if</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Gray;">$</span><span style="color: Blue;">author</span><span style="color: Gray;">.</span><span style="color: Blue;">val</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;"> != </span><span style="color: #8b0000;">'</span><span style="color: #8b0000;">'</span><span style="color: Gray;"> &amp;&amp; $</span><span style="color: Blue;">author_email</span><span style="color: Gray;">.</span><span style="color: Blue;">val</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;"> != </span><span style="color: #8b0000;">'</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$</span><span style="color: Blue;">author</span><span style="color: Gray;"> = $</span><span style="color: Blue;">author</span><span style="color: Gray;">.</span><span style="color: Blue;">parent</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">css</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">display</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">none</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$</span><span style="color: Blue;">author_email</span><span style="color: Gray;"> = $</span><span style="color: Blue;">author_email</span><span style="color: Gray;">.</span><span style="color: Blue;">parent</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">css</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">display</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">none</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">var</span><span style="color: Gray;"> $</span><span style="color: Blue;">author_url</span><span style="color: Gray;"> = </span><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">#url</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">parent</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">css</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">display</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">none</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$</span><span style="color: Blue;">author</span><span style="color: Gray;">.</span><span style="color: Blue;">before</span><span style="color: Olive;">(</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&lt;div class=&quot;form_line&quot;&gt;Welcom Back! </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+ $</span><span style="color: Blue;">author</span><span style="color: Gray;">.</span><span style="color: Blue;">find</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">#author</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">val</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;"> +</span><span style="color: #8b0000;">'</span><span style="color: Red;">! &lt;/div&gt;</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">append</span><span style="color: Olive;">(</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&lt;a href=&quot;#&quot;&gt;Change &amp;raquo;&lt;/a&gt;</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">click</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$</span><span style="color: Blue;">author</span><span style="color: Gray;">.</span><span style="color: Blue;">css</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">display</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$</span><span style="color: Blue;">author_email</span><span style="color: Gray;">.</span><span style="color: Blue;">css</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">display</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$</span><span style="color: Blue;">author_url</span><span style="color: Gray;">.</span><span style="color: Blue;">css</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">display</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">(</span><span style="color: Green;">this</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">parent</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">.</span><span style="color: Blue;">remove</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;"> </span><span style="color: Green;">false</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br /></span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></div></div>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fshare-this-jquery.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件修改：Share This (jQuery)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwp-kit-cn.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件：WP Kit CN</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">jQuery里面用到“打包盒”</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwp-plugins-cformsii-intro.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件介绍：cformsII 及其汉化包</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwordpress-theme-googlecode.htm&from=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress主题：GoogleCode</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/code" title="code" rel="tag">code</a>, <a href="http://sexywp.com/tags/diy" title="DIY" rel="tag">DIY</a>, <a href="http://sexywp.com/tags/javascript" title="javascript" rel="tag">javascript</a>, <a href="http://sexywp.com/tags/jquery" title="jQuery" rel="tag">jQuery</a>, <a href="http://sexywp.com/tags/my-works" title="my works" rel="tag">my works</a>, <a href="http://sexywp.com/tags/wordpress" title="WordPress" rel="tag">WordPress</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/progress-enhancement-of-comment-form.htm/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>

