<?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>Under Southern Skies &#187; 技术</title>
	<atom:link href="http://me.airhunter.com/category/%e6%8a%80%e6%9c%af/feed/" rel="self" type="application/rss+xml" />
	<link>http://me.airhunter.com</link>
	<description>迎接新变化</description>
	<lastBuildDate>Thu, 29 Dec 2011 05:39:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Java语言String的解惑</title>
		<link>http://me.airhunter.com/2011/12/29/java%e8%af%ad%e8%a8%80string%e7%9a%84%e8%a7%a3%e6%83%91/</link>
		<comments>http://me.airhunter.com/2011/12/29/java%e8%af%ad%e8%a8%80string%e7%9a%84%e8%a7%a3%e6%83%91/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 05:29:17 +0000</pubDate>
		<dc:creator>airhunter</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://me.airhunter.com/?p=245</guid>
		<description><![CDATA[公司要求转换到JAVA平台上来，所以开始研究JAVA语言。最近在看到String时，发现有很多不明白的地方。 问题1：String str2 = str1这种语法的使用，在书写明确写明了是引用的传递。那么为什么我在修改Str2的值时，Str1的内容没有跟着一起变呢？而StringBuffer就没有这些问题。 ?View Code JAVApublic class Test &#123; public static void main&#40;String&#91;&#93; args&#41; &#123; String str1 = &#34;12345&#34;; //两者指向相同的地址 String str2 = str1; //两者相等 System.out.println&#40;&#34;str1 == str2 : &#34; + &#40;str1 == str2&#41;&#41;; //给str2重新赋值 str2 = &#34;4567&#34;; //为什么str1的值没有变 System.out.println&#40;&#34;str1 = &#34; + str1&#41;; System.out.println&#40;&#34;str2 = &#34; + str2&#41;; &#125; &#125; 后在无数次尝试后得到的结论是：对于String类型，赋值的意思应该是，赋值语句右边的字符串生成一个新串，并把这个新串的引用传递给赋值语句左边String变量。所以变更str2的值后，实际上str2已不再指向str1。 网上的答案与我的猜测类似：string类型是不可改变的，也就是说，当你想改变一个string对象的时候，比如name= [...]]]></description>
			<content:encoded><![CDATA[<p>公司要求转换到JAVA平台上来，所以开始研究JAVA语言。最近在看到String时，发现有很多不明白的地方。<br />
<strong>问题1：</strong>String str2 = str1这种语法的使用，在书写明确写明了是引用的传递。那么为什么我在修改Str2的值时，Str1的内容没有跟着一起变呢？而StringBuffer就没有这些问题。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p245code3'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2453"><td class="code" id="p245code3"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span> str1 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12345&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//两者指向相同的地址</span>
        <span style="color: #003399;">String</span> str2 <span style="color: #339933;">=</span> str1<span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//两者相等</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str1 == str2 : &quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>str1 <span style="color: #339933;">==</span> str2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//给str2重新赋值</span>
        str2 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;4567&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//为什么str1的值没有变</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str1 = &quot;</span> <span style="color: #339933;">+</span> str1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str2 = &quot;</span> <span style="color: #339933;">+</span> str2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>后在无数次尝试后得到的结论是：对于String类型，赋值的意思应该是，赋值语句右边的字符串生成一个新串，并把这个新串的引用传递给赋值语句左边String变量。所以变更str2的值后，实际上str2已不再指向str1。<br />
网上的答案与我的猜测类似：string类型是不可改变的，也就是说，当你想改变一个string对象的时候，比如name= “madding ”<br />
那么虚拟机不会改变原来的对象，而是生成一个新的string对象，然后让name去指向它，如果原来的那个 “tom “没有任何对象去引用它，虚拟机的垃圾回收机制将接收它。</p>
<p><strong>问题2：</strong>String str1 = “123456&#8243;;和String str1 = new String(“123456&#8243;)的区别在哪里？<br />
尝试后的结论是：不用new的话，会把字符串放入java的pool中缓存起来，下一次如果有另一个变量用到这个字符串时，会直接把这个字符串的引用给它。而new的是直接生成一个新串，不会检查pool中的缓存。测试的示例如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p245code4'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2454"><td class="code" id="p245code4"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span> str1 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12345&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//两者指向相同的地址</span>
        <span style="color: #003399;">String</span> str2 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12345&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//两者相等</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str1 == str2 : &quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>str1 <span style="color: #339933;">==</span> str2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//str3使用new方式生成。</span>
        <span style="color: #003399;">String</span> str3 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;12345&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//str3不会与str2相等</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str3 == str2 : &quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>str3 <span style="color: #339933;">==</span> str2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        str3 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12345&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//str3与str2和str1相等了</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str3 == str1 : &quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>str3 <span style="color: #339933;">==</span> str1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;str3 == str2 : &quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>str3 <span style="color: #339933;">==</span> str2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>歌曲推荐环节：<br />
《nothing else matters》，来自于Metallica在1991年发行的同名黑色封面专辑《Metallica》。曲子旋律至柔至美，是《Metallica》中唯一的情歌，适合夜深人静时，一个人静静地听。当然心情不要太坏，不然听了太忧郁。此曲创作的背景是：metallica极具天赋的贝司手cliff burton技艺非凡，是乐队的核心人物。1986年他在车祸中丧生，《nothing else matters》就是为纪念他而作,让这支很man的乐队多了份柔情,多了份伤感。优美的前奏,演唱,和声,干净的间奏,JAMES弹的SOLO,整曲中各个乐器的相互配合&#8230;不知道谁喜欢摇滚，如果你喜欢摇滚的话，就不得不听听METALLICA的《nothing else matters》（什么都无所谓）。不得不说说这个乐队，听METALLICA的歌曲，会发现他们的主音吉他非常的厉害，几乎每首歌曲中的大段吉他SOLO都具有非常的难度且极为耐听，最为难得的是主唱James Hetfield的超绝嗓音和唱功，James Hetfield的嗓音高亢时如钛金一般铿锵，却也有其柔和的一面，听听这首歌吧。你会喜欢的。（<a title="Noting Else Matters" href="http://baike.baidu.com/view/3092973.htm">百度百科</a>）</p>
<p style="text-align: center;">
<object width="257" height="33" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.xiami.com/widget/0_1070393/singlePlayer.swf" /><param name="wmode" value="transparent" /><embed width="257" height="33" type="application/x-shockwave-flash" src="http://www.xiami.com/widget/0_1070393/singlePlayer.swf" wmode="transparent" /></object><br />
So close, no matter how far 如此靠近，不管有多远<br />
Couldn&#8217;t be much more from the heart 不可能比心更遥远<br />
Forever trusting who we are 永远相信我们自己<br />
And nothing else matters 一切都无关紧要<br />
Never opened myself this way 从来不曾如此敞开胸怀<br />
Life is ours, we live it our way 人生属於我们，我们过着自己的生活<br />
All these words I don&#8217;t just say 这些话我不会说出口<br />
And nothing else matters 一切都无关紧要<br />
Trust I seek and I find in you 我信任我寻觅到的你<br />
Every day for us something new 对我俩而言，每天都是新的开始<br />
Open mind for a different view 敞开心门，接收不同的视野<br />
And nothing else matters 一切都无关紧要<br />
Never cared for what they do 绝不在乎别人做了什麽<br />
Never cared for what they know 绝不在乎别人知道什麽<br />
But I know 但我明白<br />
So close, no matter how far 如此靠近，不管有多远<br />
Couldn&#8217;t be much more from the heart 不可能比心更遥远<br />
Forever trusting who we are 永远相信我们自己<br />
And nothing else matters 一切都无关紧要<br />
Never cared for what they do 绝不在乎别人做了什麽<br />
Never cared for what they know 绝不在乎别人知道什麽<br />
But I know 但我明白<br />
Never opened myself this way 从来不曾如此敞开胸怀<br />
Life is ours, we live it our way 人生属於我们，我们过着自己的生活<br />
All these words I don&#8217;t just say 这些话我不会说出口<br />
And nothing else matters 一切都无关紧要<br />
Trust I seek and I find in you 我信任我寻觅到的你<br />
Every day for us, something new 对我俩而言，每天都是新的开始<br />
Open mind for a different view 敞开心门，接收不同的视野<br />
And nothing else matters 一切都无关紧要<br />
Never cared for what they say绝不在乎别人说了什么<br />
Never cared for games they play绝不在乎别人玩什么游戏<br />
Never cared for what they do 绝不在乎别人做了什麽<br />
Never cared for what they know 绝不在乎别人知道什麽<br />
But I know 但我明白<br />
So close, no matter how far 如此靠近，不管有多远<br />
Couldn&#8217;t be much more from the heart 不可能比心更遥远<br />
Forever trusting who we are 永远相信我们自己<br />
No, nothing else matters 一切都无关紧要</p>
]]></content:encoded>
			<wfw:commentRss>http://me.airhunter.com/2011/12/29/java%e8%af%ad%e8%a8%80string%e7%9a%84%e8%a7%a3%e6%83%91/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IXMLDocument的使用</title>
		<link>http://me.airhunter.com/2007/12/27/ixmldocument%e7%9a%84%e4%bd%bf%e7%94%a8/</link>
		<comments>http://me.airhunter.com/2007/12/27/ixmldocument%e7%9a%84%e4%bd%bf%e7%94%a8/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 00:32:00 +0000</pubDate>
		<dc:creator>airhunter</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://wordpress.airhunter.com/?p=87</guid>
		<description><![CDATA[　　最近要和其它厂商的系统互相交换数据。提到要通过XML实现。花了点时间学习了一下，把一些要点记下来，免得浪费今天的劳动成果～有些函数还是没搞明白，但实现目前的需求应该是没问题了。在此感谢令狐虫和猛禽提供滴无私帮助。 1、IXMLDocument包含哪个头文件？#include&#60;XMLDoc.hpp&#62; 2、如何创建一个XML对象？ //生成一个XMLDocument对象。//对象生成后不用自己释放。_di_IXMLDocument X = NewXMLDocument(); AnsiString rootpath = “c:\\Temp”;X->Active = true;//添加一个NodeName叫”dir”_di_IXMLNode ix = X->AddChild(“dir”);//添加Node下的一字Attributes为”id”//Value为”1001&#8243; ix->Attributes["id"] = “1001&#8243;;ix->Attributes["name"] = “file1.txt”;ix->Attributes["path"] = “c:\\temp”;//保存为XML文件。X->SaveToFile(“c:\\temp\\files.xml”); 3、如何创建树状节结？//在上面代码的基础上添加。//在Node下面添加一个子节点_di_IXMLNode ix = node->AddChild(“file”); ix->Attributes["id"] = “id”;ix->Attributes["name"] = name;ix->Attributes["path"] = Path;ix->Attributes["type"] = “type”; 4、如何读取XML？//取得XML对象// 同样不用管释放 _di_IXMLDocument xml =LoadXMLDocument(“c:\\temp\\files.xml”); //取得XML中的元素。//这个root是啥我也不知道。 //我理解为root是整个XML的根_di_IXMLNode root = xml->GetDocumentElement(); //得到root的子节点_di_IXMLNodeList nodelist = root->ChildNodes;//_di_IXMLNodeList有一个Count属性for(int i = 0; i &#60; [...]]]></description>
			<content:encoded><![CDATA[<p>　　最近要和其它厂商的系统互相交换数据。提到要通过XML实现。花了点时间学习了一下，把一些要点记下来，免得浪费今天的劳动成果～有些函数还是没搞明白，但实现目前的需求应该是没问题了。在此感谢令狐虫和猛禽提供滴无私帮助。<span style="font-weight: bold;"></p>
<p></span></p>
<p><span style="font-weight: bold;"></span><span style="font-weight: bold;">1、IXMLDocument包含哪个头文件？</span><br /><span style="color: rgb(0, 153, 0);">#include&lt;XMLDoc.hpp&gt;<xmldoc.hpp></xmldoc.hpp></span><xmldoc.hpp><br /></xmldoc.hpp><xmldoc.hpp></p>
<p><span style="font-weight: bold;">2、如何创建一个XML对象？</span></xmldoc.hpp></p>
<p><span style="color: rgb(0, 0, 153);">//生成一个XMLDocument对象。<br />//对象生成后不用自己释放。</span><br /><xmldoc.hpp>_di_IXMLDocument X = NewXMLDocument(); <span style="color: rgb(0, 0, 153);"></span><br />                                                                        AnsiString  rootpath = <span style="color: rgb(0, 153, 0);">“c:\\Temp”</span>;<br />X->Active = true;</xmldoc.hpp><span style="color: rgb(0, 0, 153);"><br />//添加一个NodeName叫”dir”</span><br /><xmldoc.hpp>_di_IXMLNode ix = X->AddChild(<span style="color: rgb(0, 153, 0);">“dir”</span>);<br /></xmldoc.hpp><span style="color: rgb(0, 0, 153);">//添加Node下的一字Attributes为”id”<br /></span><span style="color: rgb(0, 0, 153);">//Value为”1001&#8243;                           </span><br /><xmldoc.hpp>ix->Attributes[<span style="color: rgb(0, 153, 0);">"id"</span>] =  <span style="color: rgb(0, 153, 0);">“1001&#8243;</span>;<br />ix->Attributes[<span style="color: rgb(0, 153, 0);">"name"</span>] = <span style="color: rgb(0, 0, 153);">“file1.txt”</span>;<br />ix->Attributes[<span style="color: rgb(0, 153, 0);">"path"</span>] = <span style="color: rgb(0, 0, 153);">“c:\\temp”</span>;<br /></xmldoc.hpp><span style="color: rgb(0, 0, 153);">//保存为XML文件。</span><br /><xmldoc.hpp>X->SaveToFile(<span style="color: rgb(0, 153, 0);">“c:\\temp\\files.xml”</span>);</p>
<p><span style="font-weight: bold;">3、如何创建树状节结？</span><br /><span style="color: rgb(0, 0, 153);">//在上面代码的基础上添加。<br /></span></xmldoc.hpp><span style="color: rgb(0, 0, 153);">//在Node下面添加一个子节点</span><br /><xmldoc.hpp>_di_IXMLNode ix = node->AddChild(<span style="color: rgb(0, 153, 0);">“file”</span>); <span style="color: rgb(0, 0, 153);"></span><br />ix->Attributes[<span style="color: rgb(0, 153, 0);">"id"</span>] =  <span style="color: rgb(0, 153, 0);">“id”</span>;<br />ix->Attributes[<span style="color: rgb(0, 153, 0);">"name"</span>] = name;<br />ix->Attributes[<span style="color: rgb(0, 153, 0);">"path"</span>] = Path;<br />ix->Attributes[<span style="color: rgb(0, 153, 0);">"type"</span>] = <span style="color: rgb(0, 153, 0);">“type”</span>;</p>
<p><span style="font-weight: bold;">4、如何读取XML？<br /></span></xmldoc.hpp><span style="color: rgb(0, 0, 153);">//取得XML对象<br /></span><span style="color: rgb(0, 0, 153);">// 同样不用管释放</span><br /><xmldoc.hpp>   _di_IXMLDocument xml =LoadXMLDocument(<span style="color: rgb(0, 153, 0);">“c:\\temp\\files.xml”</span>);<span style="color: rgb(0, 0, 153);"> </span><br />                                                                                                                   </xmldoc.hpp><span style="color: rgb(0, 0, 153);">//取得XML中的元素。<br /></span><span style="color: rgb(0, 0, 153);">//这个root是啥我也不知道。<br /></span><span style="color: rgb(0, 0, 153);">                                                                                                //我理解为root是整个XML的根</span><br /><xmldoc.hpp>_di_IXMLNode root = xml->GetDocumentElement();<br />                                                                                    </xmldoc.hpp><span dragover="true" style="color: rgb(0, 0, 153);">//得到root的子节点</span><br /><xmldoc.hpp>_di_IXMLNodeList nodelist = root->ChildNodes;<span dragover="true" style="color: rgb(0, 0, 153);"><br /></span></xmldoc.hpp><span style="color: rgb(0, 0, 153);">//_di_IXMLNodeList有一个Count属性</span><xmldoc.hpp><br /><span style="font-weight: bold;">for</span>(<span style="font-weight: bold;">int </span>i = 0; i &lt; nodelist-&gt;Count; i ++) <span style="color: rgb(0, 0, 153);"></span><br />{<br />　AnsiString str;<br /></xmldoc.hpp><span style="color: rgb(0, 0, 153);">　//遍历Node</span><br /><xmldoc.hpp>　_di_IXMLNode node = nodelist->Nodes[i];<br /></xmldoc.hpp><span style="color: rgb(0, 0, 153);">　//从属性中取得Attribute</span><br /><xmldoc.hpp>　WideString wpath = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“path”</span>)); <span style="color: rgb(0, 0, 153);"></span><br />　WideString wfile = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“name”</span>));<br />　str = wpath + <span style="color: rgb(0, 153, 0);">“\\”</span> +  wfile;<br />　Memo1->Lines->Add(str);<br /></xmldoc.hpp><span style="color: rgb(0, 0, 153);">　//下面这段一样<br />　//只是演试一下如何得到一下层</span><br /><xmldoc.hpp>　_di_IXMLNodeList childlist = node->GetChildNodes(); <span style="color: rgb(0, 0, 153);"></span></p>
<p><span style="font-weight: bold;">　for</span>(<span style="font-weight: bold;">int </span>j = 0; j &lt;childlist-&gt;Count; j++)<br />　{<br />　　AnsiString str;<br />　　_di_IXMLNode node = childlist->Nodes[j];<br />　　WideString wpath = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“path”</span>));<br />　　WideString wfile = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“name”</span>));</p>
<p>　　str = <span style="color: rgb(0, 153, 0);">”   “</span> + wpath + <span style="color: rgb(0, 153, 0);">“\\”</span> +  wfile;<br />　　Memo1->Lines->Add(str);<br />　}<br />}</p>
<p><span style="font-weight: bold;">5、其它有用的方法</span><br /><span style="color: rgb(255, 0, 0);"> _di_IXMLNode有一个NodeTpye表明这个Node的类型。但不知道在何时使用它。</span><br /><span style="color: rgb(255, 0, 0);"> _di_IXMLNode有一个NodeValue，我猜是用来表明这个NodeValue的类型。但不知道在何时使用它。也不知道怎么用，总是报错。</span></p>
<p><span style="font-weight: bold;">附一个例子：</span><vcl.h><xmldoc.hpp><span style="color: rgb(0, 153, 0);"></span><br />TForm1 *Form1;</p>
<p><span style="font-weight: bold;">void </span>AddPath(AnsiString Path, _di_IXMLNode node)<br />{<br /><span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0);">　AnsiString</span> </span>FilePath=Path+<span style="color: rgb(0, 0, 153);">“\\*.*”</span>;<br />　TSearchRec sr;<br />　sr.Name=FilePath;<br /><span style="font-weight: bold;">　int </span>done;<br />　done = FindFirst(FilePath,faAnyFile,sr);<br />　AnsiString FileName;<br /><span style="font-weight: bold;">　while </span>(!done)      {<br />　　FileName=Path+<span style="color: rgb(0, 153, 0);">“\\”</span>+sr.Name;<br />　　FileSetAttr(FileName,<span style="color: rgb(0, 0, 153);">0</span>);<br /><span style="font-weight: bold;">　　if</span>(sr.Attr &amp; faDirectory&amp;&amp;sr.Name[<span style="color: rgb(0, 0, 153);">1</span>]!=<span style="color: rgb(0, 153, 0);">&#8216;.&#8217;</span>) {<br />　　　_di_IXMLNode ix = node->AddChild(<span style="color: rgb(0, 153, 0);">“dir”</span>);<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"id"</span>] =  <span style="color: rgb(0, 153, 0);">“id”</span>;<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"name"</span>] = sr.Name;<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"path"</span>] = Path;<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　AddPath(FileName, ix);<br />　　}<br /><span style="font-weight: bold;">　　else </span>{<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　_di_IXMLNode ix = node->AddChild(<span style="color: rgb(0, 153, 0);">“file”</span>);<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"id"</span>] =  <span style="color: rgb(0, 153, 0);">“id”</span>;<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"name"</span>] = sr.Name;<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"path"</span>] = Path;<br /></xmldoc.hpp></vcl.h></xmldoc.hpp>             <xmldoc.hpp><vcl.h><xmldoc.hpp>　　　ix->Attributes[<span style="color: rgb(0, 153, 0);">"type"</span>] = “type”;<br />　　}<br />　　done = FindNext(sr);<br />　}<br />　FindClose(sr);<br />}<br /><span style="color: rgb(0, 0, 153);">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span><br /><span style="font-weight: bold;">__fastcall </span>TForm1::TForm1(TComponent* Owner)<br />: TForm(Owner)<br />{<br />　_di_IXMLDocument X = NewXMLDocument();<br />　AnsiString  rootpath = <span style="color: rgb(0, 153, 0);">“c:\\Temp”</span>;<br />　X->Active = <span style="font-weight: bold;">true</span>;<br />　_di_IXMLNode ix = X->AddChild(<span style="color: rgb(0, 153, 0);">“dir”</span>);<br />　ix->Attributes[<span style="color: rgb(0, 153, 0);">"id"</span>] =  <span style="color: rgb(0, 153, 0);">“”</span>;<br />　ix->Attributes[<span style="color: rgb(0, 153, 0);">"name"</span>] = ExtractFileName(rootpath);<br />　ix->Attributes[<span style="color: rgb(0, 153, 0);">"path"</span>] = ExtractFilePath(rootpath);<br />　AddPath(rootpath, ix);<br />　X->SaveToFile(<span style="color: rgb(0, 153, 0);">“c:\\temp\\files.xml”</span>);<br />}<br /><span style="color: rgb(0, 0, 153);">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span><br /><span style="font-weight: bold;">void __fastcall</span> TForm1::Button1Click(TObject *Sender)<br />{<br />　_di_IXMLDocument xml =LoadXMLDocument(<span style="color: rgb(0, 153, 0);">“c:\\temp\\files.xml”</span>);<br />　_di_IXMLNode root = xml->GetDocumentElement();</p>
<p>　_di_IXMLNodeList nodelist = root->ChildNodes;<br /><span style="font-weight: bold;">　for</span>(<span style="font-weight: bold;">int </span>i = <span style="color: rgb(0, 0, 153);">0</span>; i &lt;nodelist->&gt;Count; i++)<br />　{<br />　　AnsiString str;<br />　　_di_IXMLNode node = nodelist->Nodes[i];<br />　　WideString wpath = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“path”</span>));<br />　　WideString wfile = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“name”</span>));<br />　　str = wpath + <span style="color: rgb(0, 153, 0);">“\\”</span> +  wfile;<br />　　Memo1->Lines->Add(str);<br />　　_di_IXMLNodeList childlist = node->GetChildNodes();<br /><span style="font-weight: bold;">　　for</span>(<span style="font-weight: bold;">int </span>j = <span style="color: rgb(0, 0, 153);">0</span>;</xmldoc.hpp></vcl.h></xmldoc.hpp> j &lt;childlist-&gt;<xmldoc.hpp><vcl.h><xmldoc.hpp>Count; j++)<br />　　{<br />　　　AnsiString str;<br />　　　_di_IXMLNode node = childlist->Nodes[j];<br />　　　WideString wpath = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“path”</span>));<br />　　　WideString wfile = node->GetAttribute(WideString(<span style="color: rgb(0, 153, 0);">“name”</span>));<br />　　　str = <span style="color: rgb(0, 153, 0);">”   “</span> + wpath + <span style="color: rgb(0, 153, 0);">“\\”</span> +  wfile;<br />　　　Memo1->Lines->Add(str);<br />　　}<br />　}<br />}<br /><span style="color: rgb(0, 0, 153);">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></xmldoc.hpp></vcl.h></xmldoc.hpp></p>
]]></content:encoded>
			<wfw:commentRss>http://me.airhunter.com/2007/12/27/ixmldocument%e7%9a%84%e4%bd%bf%e7%94%a8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ADO异步执行</title>
		<link>http://me.airhunter.com/2005/11/03/ado%e5%bc%82%e6%ad%a5%e6%89%a7%e8%a1%8c/</link>
		<comments>http://me.airhunter.com/2005/11/03/ado%e5%bc%82%e6%ad%a5%e6%89%a7%e8%a1%8c/#comments</comments>
		<pubDate>Thu, 03 Nov 2005 04:48:00 +0000</pubDate>
		<dc:creator>airhunter</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://wordpress.airhunter.com/?p=52</guid>
		<description><![CDATA[　　看了猛禽和令狐的贴子才知道原来google今天死掉乐，偶还以为就偶一个人登不了Gmail呢。现在放心乐，不是偶的RPWT。　　上次问了令狐关于数据库如何在做大数据量或执行很慢的操作时不会让界面死掉。记得令狐当时是说数据库本身就是支持这个功能的，然后就说了一堆以偶的IQ比较难以理解的话。好在在GOOGLE的帮助下还是找到了方法，和令狐说得也差不多，果然ADO就带有这个功能。只要设置ADOQuery或ADODataSet中的ExectueOption属性的eoAsyncFetchNonBlocking为true就可以乐。然后在OnFetchProgress和OnFetchComplete事件中作处理就行乐：）而在处理中想中止的话，只要简单的Close就行乐。 BTW　1：才说到偶和空姐失去联系了，没想到话刚说完的第二天就在网上遇到了她。看来考试后就没再回嘉兴，本来还真想跑回去见她一面，整整五年没见过她乐：（空姐现在对BLOG很感兴趣，AirHostess&#8217; Blog看来就快要开张乐。 BTW　2：偶的Filckr也开张乐，可惜目前没有图片（至少没有公开的图片）。等有相机的时候请大家去参观吧。(Filckr + Blogspot果然是无敌的)]]></description>
			<content:encoded><![CDATA[<p>　　看了<a href="http://raptor.mblogger.cn/">猛禽</a>和<a href="http://borland.mblogger.cn/topcat/">令狐</a>的贴子才知道原来google今天死掉乐，偶还以为就偶一个人登不了Gmail呢。现在放心乐，不是偶的RPWT。<br />　　上次问了<a href="http://borland.mblogger.cn/topcat/">令狐</a>关于数据库如何在做大数据量或执行很慢的操作时不会让界面死掉。记得<a href="http://borland.mblogger.cn/topcat/">令狐</a>当时是说数据库本身就是支持这个功能的，然后就说了一堆以偶的IQ比较难以理解的话。好在在GOOGLE的帮助下还是找到了方法，和<a href="http://borland.mblogger.cn/topcat/">令狐</a>说得也差不多，果然ADO就带有这个功能。只要设置ADOQuery或ADODataSet中的ExectueOption属性的eoAsyncFetchNonBlocking为true就可以乐。然后在OnFetchProgress和OnFetchComplete事件中作处理就行乐：）而在处理中想中止的话，只要简单的Close就行乐。</p>
<p>
<p>BTW　1：才说到偶和空姐失去联系了，没想到话刚说完的第二天就在网上遇到了她。看来考试后就没再回嘉兴，本来还真想跑回去见她一面，整整五年没见过她乐：（空姐现在对BLOG很感兴趣，AirHostess&#8217; Blog看来就快要开张乐。</p>
<p>
<p>BTW　2：<a href="http://www.flickr.com/photos/airhunter/">偶的Filckr</a>也开张乐，可惜目前没有图片（至少没有公开的图片）。等有相机的时候请大家去参观吧。(Filckr + Blogspot果然是无敌的)</p>
]]></content:encoded>
			<wfw:commentRss>http://me.airhunter.com/2005/11/03/ado%e5%bc%82%e6%ad%a5%e6%89%a7%e8%a1%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BCB疑难问题</title>
		<link>http://me.airhunter.com/2005/07/12/bcb%e7%96%91%e9%9a%be%e9%97%ae%e9%a2%98/</link>
		<comments>http://me.airhunter.com/2005/07/12/bcb%e7%96%91%e9%9a%be%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Tue, 12 Jul 2005 07:10:00 +0000</pubDate>
		<dc:creator>airhunter</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://wordpress.airhunter.com/?p=42</guid>
		<description><![CDATA[今天在修改同事的代码时发生的怪问题，原来的Cut、Paste、Copy等功能都失灵了，断点后发现ActiveControl总是得到NULL值。（偶是把窗体嵌入到另一个窗体中）。最后还是猛禽解释了原因。 (2005-07-12 17:01:48) 猛禽 这个问题在ActiveControl上 (2005-07-12 17:02:17) 猛禽 当frm是独立窗体是，ActiveControl是它上面的控件 (2005-07-12 17:02:50) 猛禽 当你放到另一个窗体上时，这个子窗体本身变成了ActiveControl (2005-07-12 17:03:14) 空中猎手 但这时通过断点得到的ActiveControl是空值 (2005-07-12 17:03:18) 猛禽 因为它是Form不是Memo，所以dynamic_cast会返回0 (2005-07-12 17:03:44) 空中猎手 在dynamic_cast操作之前就是NULL (2005-07-12 17:04:08) 猛禽 那就是因为这个窗体本身变成control了，所以它就没有ActiveControl了 (2005-07-12 17:04:24) 猛禽 你必须取它的Parent的ActiveCtrol才可以 又学到一手，好久都没聊技术了，啥都不熟了：） BTW：　　１、今天找到很多不错的诗，大家多多参观：《青春》、《索价》、《在非洲》　　２、空姐生日快到乐，想送空姐一份生日礼物，但空姐就是不收，郁闷。现在不知道地址，没办法送乐，有钱用不掉指得多半就是现在这种情况@_@]]></description>
			<content:encoded><![CDATA[<p>今天在修改同事的代码时发生的怪问题，原来的Cut、Paste、Copy等功能都失灵了，断点后发现ActiveControl总是得到NULL值。（偶是把窗体嵌入到另一个窗体中）。最后还是<a href="http://borland.mblogger.cn/raptor">猛禽</a>解释了原因。</p>
<div style="text-align: left;"><span style="color: rgb(51, 153, 102);">(2005-07-12 17:01:48)   猛禽</span> <span style="color: rgb(51, 153, 102);">这个问题在ActiveControl上 </span> <span style="color: rgb(51, 153, 102);">(2005-07-12 17:02:17)   猛禽</span> <span style="color: rgb(51, 153, 102);">当frm是独立窗体是，ActiveControl是它上面的控件 </span> <span style="color: rgb(51, 153, 102);">(2005-07-12 17:02:50)   猛禽</span> <span style="color: rgb(51, 153, 102);">当你放到另一个窗体上时，这个子窗体本身变成了ActiveControl </span><br /><span style="color: rgb(255, 102, 0);">(2005-07-12 17:03:14)   空中猎手</span> <span style="color: rgb(255, 102, 0);">但这时通过断点得到的ActiveControl是空值 </span><br /><span style="color: rgb(51, 153, 102);">(2005-07-12 17:03:18)   猛禽</span> <span style="color: rgb(51, 153, 102);">因为它是Form不是Memo，所以dynamic_cast会返回0 </span><br /><span style="color: rgb(255, 102, 0);">(2005-07-12 17:03:44)   空中猎手</span> <span style="color: rgb(255, 102, 0);">在dynamic_cast操作之前就是NULL </span><br /><span style="color: rgb(51, 153, 102);">(2005-07-12 17:04:08)   猛禽</span> <span style="color: rgb(51, 153, 102);">那就是因为这个窗体本身变成control了，所以它就没有ActiveControl了 </span> <span style="color: rgb(51, 153, 102);">(2005-07-12 17:04:24)   猛禽</span> <span style="color: rgb(128, 0, 0);"><span style="color: rgb(51, 153, 102);">你必须取它的Parent的ActiveCtrol才可以 </span></p>
<p></span></div>
<p>又学到一手，好久都没聊技术了，啥都不熟了：）</p>
<p>BTW：<br />　　１、今天找到很多不错的诗，大家多多参观：《<a href="http://borland.mblogger.cn/airhunter/posts/22547.aspx">青春</a>》、《<a href="http://borland.mblogger.cn/airhunter/posts/22550.aspx">索价</a>》、《<a href="http://borland.mblogger.cn/airhunter/posts/22551.aspx">在非洲</a>》<br />　　２、空姐生日快到乐，想送空姐一份生日礼物，但空姐就是不收，郁闷。现在不知道地址，没办法送乐，有钱用不掉指得多半就是现在这种情况@_@</p>
]]></content:encoded>
			<wfw:commentRss>http://me.airhunter.com/2005/07/12/bcb%e7%96%91%e9%9a%be%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>设置打印端口终于解决鸟～～</title>
		<link>http://me.airhunter.com/2005/04/05/%e8%ae%be%e7%bd%ae%e6%89%93%e5%8d%b0%e7%ab%af%e5%8f%a3%e7%bb%88%e4%ba%8e%e8%a7%a3%e5%86%b3%e9%b8%9f%ef%bd%9e%ef%bd%9e/</link>
		<comments>http://me.airhunter.com/2005/04/05/%e8%ae%be%e7%bd%ae%e6%89%93%e5%8d%b0%e7%ab%af%e5%8f%a3%e7%bb%88%e4%ba%8e%e8%a7%a3%e5%86%b3%e9%b8%9f%ef%bd%9e%ef%bd%9e/#comments</comments>
		<pubDate>Tue, 05 Apr 2005 06:37:00 +0000</pubDate>
		<dc:creator>airhunter</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://wordpress.airhunter.com/?p=22</guid>
		<description><![CDATA[网上找到一篇《Command line Printer Control in Windows 2000/XP》，里面介绍了通过命令控制打印机，测试也成功乐，这下不能再去理会SetPrinter了（虽然说得迎难而上，不过遇上这种RPWT我也没办法鸟）。 一条命令就解决我的问题，哈哈哈RUNDLL32 PRINTUI.DLL,PrintUIEntry /Xs /n "printer" PortName "port:" 具体帮助可以在命令行下输入以下语句得到：RUNDLL32 PRINTUI.DLL,PrintUIEntry /? 今天整理GMAIL时才发现我刚到上海时在网上发的找房消息竟然有人回复鸟，只是被GMAIL误认为是“垃圾邮件”给放到Spam里了，２室１厅１卫，离公司近到只用走路上班就行了，而且合住的还是位MM。现在到好了，啥都木有鸟。唉～～～怪偶过去一直没注意唉～～～]]></description>
			<content:encoded><![CDATA[<p>网上找到一篇《Command line Printer Control in Windows 2000/XP》，里面介绍了通过命令控制打印机，测试也成功乐，这下不能再去理会SetPrinter了（虽然说得迎难而上，不过遇上这种RPWT我也没办法鸟）。</p>
<p>一条命令就解决我的问题，哈哈哈<br /><code><span style="color:#005900;">RUNDLL32 PRINTUI.DLL,PrintUIEntry /Xs /n "<i>printer</i>" PortName "<i>port:</i>"</p>
<p><span style="color: rgb(0, 0, 0);">具体帮助可以在命令行下输入以下语句得到：<br /></span></span></code><code><span style="color:#005900;">RUNDLL32 PRINTUI.DLL,PrintUIEntry /?</p>
<p><span style="color: rgb(0, 0, 0);">今天整理GMAIL时才发现我刚到上海时在网上发的找房消息竟然有人回复鸟，只是被GMAIL误认为是“垃圾邮件”给放到Spam里了，２室１厅１卫，离公司近到只用走路上班就行了，而且合住的还是位MM。现在到好了，啥都木有鸟。唉～～～怪偶过去一直没注意唉～～～</span></span></code><span style="font-weight: bold;"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://me.airhunter.com/2005/04/05/%e8%ae%be%e7%bd%ae%e6%89%93%e5%8d%b0%e7%ab%af%e5%8f%a3%e7%bb%88%e4%ba%8e%e8%a7%a3%e5%86%b3%e9%b8%9f%ef%bd%9e%ef%bd%9e/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

