<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Thủ Thuật Access - XML]]></title>
		<link>https://thuthuataccess.com/forum/</link>
		<description><![CDATA[Thủ Thuật Access - https://thuthuataccess.com/forum]]></description>
		<pubDate>Tue, 21 Apr 2026 14:52:52 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Tải file rss dạng XML, và hiển thị nội dung lên web bằng php]]></title>
			<link>https://thuthuataccess.com/forum/thread-11476.html</link>
			<pubDate>Mon, 04 May 2020 04:16:13 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://thuthuataccess.com/forum/member.php?action=profile&uid=1">Noname</a>]]></dc:creator>
			<guid isPermaLink="false">https://thuthuataccess.com/forum/thread-11476.html</guid>
			<description><![CDATA[Không liên quan Access lắm, nhưng có liên quan đến xử lý XML, xin chia sẻ đoạn code tôi dùng để đọc nội dung trang web có chia sẻ nguồn tin RSS dạng XML, sau đó hiển thị nó lên trình duyệt web, viết bằng Php<br />
<br />
<br />
Vì một vài trang bị chặn, nên tôi thông qua 1 bước trung gian là dùng trang <a href="https://feeds.feedburner.com" target="_blank" rel="noopener" class="mycode_url">https://feeds.feedburner.com</a> để tải file Rss ấy về,<br />
sau đó load trang RSS lên, phân tích kết cấu của nó và hiển thị lại trên web.<br />
Nhân đó gán luôn trang Proxy để có thể vượt tường lửa.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">Mã PHP:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />&#36;xml&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">simplexml_load_file</span><span style="color: #007700">(</span><span style="color: #DD0000">"https://feeds.feedburner.com/Voa-tintuc"</span><span style="color: #007700">);<br />foreach&nbsp;(</span><span style="color: #0000BB">&#36;xml&nbsp;</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">children</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">){<br />foreach(</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">children</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">){<br /></span><span style="color: #0000BB">&#36;s1</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">title</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;s2</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">description</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;s3</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pubDate</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;s4</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">link</span><span style="color: #007700">;<br />if&nbsp;(</span><span style="color: #0000BB">&#36;s4</span><span style="color: #007700">!=</span><span style="color: #DD0000">""</span><span style="color: #007700">){<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;a&nbsp;href='https://vn3000.com/b/"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;s4</span><span style="color: #007700">.</span><span style="color: #DD0000">"'&gt;"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;s1</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;/a&gt;&lt;br/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">&#36;s3</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">&#36;s2</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br/&gt;"</span><span style="color: #007700">;<br />}<br />}<br />}&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div> <br />
<br />
Kết quả:<br />
<a href="https://thuthuataccess.com/search.php" target="_blank" rel="noopener" class="mycode_url">https://thuthuataccess.com/search.php</a>]]></description>
			<content:encoded><![CDATA[Không liên quan Access lắm, nhưng có liên quan đến xử lý XML, xin chia sẻ đoạn code tôi dùng để đọc nội dung trang web có chia sẻ nguồn tin RSS dạng XML, sau đó hiển thị nó lên trình duyệt web, viết bằng Php<br />
<br />
<br />
Vì một vài trang bị chặn, nên tôi thông qua 1 bước trung gian là dùng trang <a href="https://feeds.feedburner.com" target="_blank" rel="noopener" class="mycode_url">https://feeds.feedburner.com</a> để tải file Rss ấy về,<br />
sau đó load trang RSS lên, phân tích kết cấu của nó và hiển thị lại trên web.<br />
Nhân đó gán luôn trang Proxy để có thể vượt tường lửa.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">Mã PHP:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />&#36;xml&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">simplexml_load_file</span><span style="color: #007700">(</span><span style="color: #DD0000">"https://feeds.feedburner.com/Voa-tintuc"</span><span style="color: #007700">);<br />foreach&nbsp;(</span><span style="color: #0000BB">&#36;xml&nbsp;</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">children</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">){<br />foreach(</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">children</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">){<br /></span><span style="color: #0000BB">&#36;s1</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">title</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;s2</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">description</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;s3</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pubDate</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;s4</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;value1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">link</span><span style="color: #007700">;<br />if&nbsp;(</span><span style="color: #0000BB">&#36;s4</span><span style="color: #007700">!=</span><span style="color: #DD0000">""</span><span style="color: #007700">){<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;a&nbsp;href='https://vn3000.com/b/"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;s4</span><span style="color: #007700">.</span><span style="color: #DD0000">"'&gt;"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;s1</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;/a&gt;&lt;br/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">&#36;s3</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">&#36;s2</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br/&gt;"</span><span style="color: #007700">;<br />}<br />}<br />}&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div> <br />
<br />
Kết quả:<br />
<a href="https://thuthuataccess.com/search.php" target="_blank" rel="noopener" class="mycode_url">https://thuthuataccess.com/search.php</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Hàm cơ bản về XML]]></title>
			<link>https://thuthuataccess.com/forum/thread-11471.html</link>
			<pubDate>Sat, 02 May 2020 16:16:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://thuthuataccess.com/forum/member.php?action=profile&uid=1091">maidinhdan</a>]]></dc:creator>
			<guid isPermaLink="false">https://thuthuataccess.com/forum/thread-11471.html</guid>
			<description><![CDATA[Đây là những hàm tôi sưu tầm chỉnh sửa lại, các bạn có thể nghiên cứu chi tiết trên web hoặc tại đây: <a href="http://www.functionx.com/vbaccess/Lesson63.htm" target="_blank" rel="noopener" class="mycode_url">Link học XML</a><br />
<br />
<span style="color: #00369B;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">1. Xuất Table sang file XML:</span></span><br />
<div class="codeblock phpcodeblock"><div class="title">Mã PHP:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;TableToXML</span><span style="color: #007700">()</span><span style="color: #0000BB"> &nbsp;</span><span style="color: #DD0000">'Thuoc&nbsp;Modules:&nbsp;Import-Export&nbsp;XML<br /> &nbsp; &nbsp;Application.ExportXML&nbsp;acExportTable,&nbsp;"tblCVDen",&nbsp;"d:&#092;xml3.xml"<br />End&nbsp;Sub&nbsp;<br /></span></code></div></div></div><br />
<br />
<span style="color: #00369B;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">2. Các hàm của tôi Xây dựng: để tương tác với XML (Đã Test chạy ok tất cả)</span></span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">Mã PHP:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;TaoFileXML2</span><span style="color: #007700">()<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;rst&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Recordset<br /> &nbsp; &nbsp;Dim&nbsp;strSQL&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;strSQL&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;SoTT,&nbsp;Ngayden,&nbsp;Soden,&nbsp;Tacgia&nbsp;FROM&nbsp;tblCVDen"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;rst&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentDb</span><span style="color: #007700">.</span><span style="color: #0000BB">OpenRecordset</span><span style="color: #007700">(</span><span style="color: #0000BB">strSQL</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /> &nbsp; &nbsp;strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;<br /> &nbsp; &nbsp;Dim&nbsp;fso&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Object<br /> &nbsp; &nbsp;Set&nbsp;fso&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CreateObject</span><span style="color: #007700">(</span><span style="color: #DD0000">"Scripting.FileSystemObject"</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;<br /> &nbsp; &nbsp;Dim&nbsp;objFile&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Object<br /> &nbsp; &nbsp;Set&nbsp;objFile&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fso</span><span style="color: #007700">.</span><span style="color: #0000BB">CreateTextFile</span><span style="color: #007700">(</span><span style="color: #0000BB">strPath</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">True</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">True</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;<br /> &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;</span><span style="color: #DD0000">"&lt;?xml&nbsp;version='1.0'?&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;</span><span style="color: #DD0000">"&lt;TableCongVanDen&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;</span><span style="color: #007700">Do&nbsp;</span><span style="color: #0000BB">Until&nbsp;rst</span><span style="color: #007700">.</span><span style="color: #0000BB">EOF<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Dong&nbsp;SoTT="&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">""""&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"SoTT"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">""""&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Ngayden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"Ngayden"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Ngayden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Soden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"Soden"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Soden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Tacgia&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tacgia"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Tacgia&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Dong&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;rst</span><span style="color: #007700">.</span><span style="color: #0000BB">MoveNext<br /> &nbsp; &nbsp;Loop<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;</span><span style="color: #DD0000">"&lt;/TableCongVanDen&gt;"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Close<br /> &nbsp; &nbsp;Set&nbsp;rst&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br /> &nbsp; &nbsp;Set&nbsp;objFile&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br /> &nbsp; &nbsp;Set&nbsp;fso&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br /> &nbsp; &nbsp;MsgBox&nbsp;</span><span style="color: #DD0000">"Complete"<br /></span><span style="color: #0000BB">End&nbsp;Sub<br /><br /></span><span style="color: #007700">Function&nbsp;</span><span style="color: #0000BB">DocNoiDungXML</span><span style="color: #007700">()<br /></span><span style="color: #DD0000">'&nbsp;Khai&nbsp;bao&nbsp;bien:&nbsp;Kieu&nbsp;ket&nbsp;noi&nbsp;muon<br />'</span><span style="color: #0000BB">Dim&nbsp;objParser&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Object<br /></span><span style="color: #DD0000">'Set&nbsp;objParser&nbsp;=&nbsp;CreateObject("Microsoft.XMLDOM") &nbsp; &nbsp; &nbsp;'&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #0000BB">Set&nbsp;objParser&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Server</span><span style="color: #007700">.</span><span style="color: #0000BB">CreateObject</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"Microsoft.XMLDOM"&nbsp;</span><span style="color: #007700">)<br /></span><span style="color: #DD0000">'or &nbsp;'</span><span style="color: #0000BB">Dang&nbsp;ky&nbsp;them&nbsp;thu&nbsp;vien</span><span style="color: #007700">:</span><span style="color: #0000BB"> &nbsp;Microsoft&nbsp;XML</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">version&nbsp;3.0 &nbsp; &nbsp;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">provided&nbsp;in&nbsp;Msxml</span><span style="color: #007700">.</span><span style="color: #0000BB">dll<br /></span><span style="color: #DD0000">'&nbsp;Khai&nbsp;bao&nbsp;bien:&nbsp;Kieu&nbsp;ket&nbsp;noi&nbsp;som<br />Dim&nbsp;xDoc&nbsp;As&nbsp;MSXML2.DOMDocument<br />Set&nbsp;xDoc&nbsp;=&nbsp;New&nbsp;MSXML2.DOMDocument<br />Dim&nbsp;strPath&nbsp;As&nbsp;String<br /> &nbsp; &nbsp;strPath&nbsp;=&nbsp;CurrentProject.path&nbsp;&amp;&nbsp;"&#092;CVDenXML.xml"<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;If&nbsp;xDoc.Load(strPath)&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DisplayNode&nbsp;xDoc.childNodes,&nbsp;0<br /> &nbsp; &nbsp; &nbsp; &nbsp;Else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;"Load&nbsp;file&nbsp;that&nbsp;bai"<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'&nbsp;</span><span style="color: #0000BB">Hien&nbsp;thi&nbsp;ma&nbsp;loi<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim&nbsp;strErrText&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim&nbsp;xPE&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">IXMLDOMParseError<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #DD0000">'&nbsp;Lay&nbsp;doi&nbsp;tuong&nbsp;ParseError<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Set&nbsp;xPE&nbsp;=&nbsp;xDoc.parseError<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;With&nbsp;xPE<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strErrText&nbsp;=&nbsp;"Tai&nbsp;lieu&nbsp;XML&nbsp;cua&nbsp;ban&nbsp;khong&nbsp;Load&nbsp;len&nbsp;duoc"&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Do&nbsp;loi&nbsp;sau:"&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Loi&nbsp;#:&nbsp;"&nbsp;&amp;&nbsp;.errorCode&nbsp;&amp;&nbsp;":&nbsp;"&nbsp;&amp;&nbsp;xPE.reason&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Dong&nbsp;#:&nbsp;"&nbsp;&amp;&nbsp;.line&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Vi&nbsp;tri&nbsp;dong:&nbsp;"&nbsp;&amp;&nbsp;.linepos&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Vi&nbsp;tri&nbsp;trong&nbsp;File:&nbsp;"&nbsp;&amp;&nbsp;.filepos&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Nguon&nbsp;van&nbsp;ban:&nbsp;"&nbsp;&amp;&nbsp;.srcText&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Document&nbsp;URL:&nbsp;"&nbsp;&amp;&nbsp;.url<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp;With<br /> &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;strErrText,&nbsp;vbExclamation<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Set&nbsp;xPE&nbsp;=&nbsp;Nothing<br /> &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp;If<br /> &nbsp; &nbsp;Set&nbsp;xDoc&nbsp;=&nbsp;Nothing<br />End&nbsp;Function<br /><br />Sub&nbsp;DisplayNode(ByRef&nbsp;Nodes&nbsp;As&nbsp;MSXML2.IXMLDOMNodeList,&nbsp;ByVal&nbsp;Indent&nbsp;As&nbsp;Integer)<br /><br /> &nbsp;Dim&nbsp;xNode&nbsp;As&nbsp;MSXML2.IXMLDOMNode<br /> &nbsp;Indent&nbsp;=&nbsp;Indent&nbsp;+&nbsp;2<br /><br /> &nbsp;For&nbsp;Each&nbsp;xNode&nbsp;In&nbsp;Nodes<br /> &nbsp; &nbsp; &nbsp;If&nbsp;xNode.nodeType&nbsp;=&nbsp;NODE_TEXT&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;Debug.Print&nbsp;Space(Indent)&nbsp;&amp;&nbsp;xNode.parentNode.nodeName&nbsp;&amp;&nbsp;":&nbsp;"&nbsp;&amp;&nbsp;xNode.nodeValue<br /> &nbsp; &nbsp; &nbsp;End&nbsp;If<br /><br /> &nbsp; &nbsp; &nbsp;If&nbsp;xNode.hasChildNodes&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;DisplayNode&nbsp;xNode.childNodes,&nbsp;Indent<br /> &nbsp; &nbsp; &nbsp;End&nbsp;If<br /> &nbsp;Next&nbsp;xNode<br />End&nbsp;Sub<br /><br />Public&nbsp;Sub&nbsp;XoaNode() &nbsp;'</span><span style="color: #0000BB">Thuoc&nbsp;Modules</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Hoc</span><span style="color: #007700">-</span><span style="color: #0000BB">Import</span><span style="color: #007700">-</span><span style="color: #0000BB">Export&nbsp;XM2<br /> &nbsp; &nbsp;Dim&nbsp;xDoc&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument<br />Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br />Dim&nbsp;strSearch&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /><br />strSearch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2<br />strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;New&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument<br /> &nbsp; &nbsp;xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">validateOnParse&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">False<br /> &nbsp; &nbsp;xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">Load&nbsp;strPath<br /><br /> &nbsp; &nbsp;DeleteNodes&nbsp;xDoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"//TableCongVanDen/Dong[@SoTT='"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">strSearch&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"']"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">Save&nbsp;strPath &nbsp;</span><span style="color: #DD0000">''</span><span style="color: #0000BB">save&nbsp;</span><span style="color: #007700">new&nbsp;</span><span style="color: #0000BB">document<br /> &nbsp; &nbsp;Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br />Sub&nbsp;DeleteNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xDoc&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">xPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;foo&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMNodeList</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">el &nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMElement<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">selectNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xPath</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">.</span><span style="color: #0000BB">Length&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0&nbsp;Then&nbsp;Debug</span><span style="color: #007700">.Print&nbsp;</span><span style="color: #DD0000">"[Xoa&nbsp;Node:&nbsp;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">xPath<br /> &nbsp; &nbsp;</span><span style="color: #007700">For&nbsp;</span><span style="color: #0000BB">Each&nbsp;el&nbsp;In&nbsp;foo<br /> &nbsp; &nbsp; &nbsp; &nbsp;el</span><span style="color: #007700">.</span><span style="color: #0000BB">parentNode</span><span style="color: #007700">.</span><span style="color: #0000BB">removeChild&nbsp;el<br /> &nbsp; &nbsp;Next&nbsp;el<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br /></span><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;TimNoiDungFileXML</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">Dim&nbsp;xDoc&nbsp;</span><span style="color: #007700">As&nbsp;New&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument30<br />Dim&nbsp;xNode&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">IXMLDOMElement<br />Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br />Dim&nbsp;strSearch&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /><br />strSearch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">14<br />strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br />'Try&nbsp;To&nbsp;Load&nbsp;The&nbsp;Document<br />With&nbsp;xDoc<br /> &nbsp; &nbsp;If&nbsp;Not&nbsp;.Load(strPath)&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;"Unable&nbsp;to&nbsp;load"<br /> &nbsp; &nbsp; &nbsp; &nbsp;Exit&nbsp;Sub<br /> &nbsp; &nbsp;End&nbsp;If<br /> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;=&nbsp;.selectSingleNode("//TableCongVanDen/Dong/Soden[.='"&nbsp;&amp;&nbsp;strSearch&nbsp;&amp;&nbsp;"']")<br />'</span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;.</span><span style="color: #0000BB">selectSingleNode</span><span style="color: #007700">(</span><span style="color: #DD0000">"//Categories/Ngayden[.='08/12/2011']"</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">Not&nbsp;xNode&nbsp;Is&nbsp;Nothing&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;Debug</span><span style="color: #007700">.Print&nbsp;</span><span style="color: #0000BB">xNode</span><span style="color: #007700">.</span><span style="color: #0000BB">Text</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">xNode</span><span style="color: #007700">.</span><span style="color: #0000BB">nodeName<br /> &nbsp; &nbsp;End&nbsp;</span><span style="color: #007700">If<br /></span><span style="color: #0000BB">End&nbsp;With<br />Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br /></span><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;SuaNoiDungXML</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">Dim&nbsp;xDoc&nbsp;</span><span style="color: #007700">As&nbsp;New&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument30<br />Dim&nbsp;xNode&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">IXMLDOMElement<br /><br />Dim&nbsp;strSearch&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /><br />strSearch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"222222"<br /></span><span style="color: #0000BB">Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br />strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br />'Try&nbsp;To&nbsp;Load&nbsp;The&nbsp;Document<br />With&nbsp;xDoc<br /> &nbsp; &nbsp;If&nbsp;Not&nbsp;.Load(strPath)&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;"Unable&nbsp;to&nbsp;load"<br /> &nbsp; &nbsp; &nbsp; &nbsp;Exit&nbsp;Sub<br /> &nbsp; &nbsp;End&nbsp;If<br /> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;=&nbsp;.selectSingleNode("//TableCongVanDen/Dong/Soden[.='"&nbsp;&amp;&nbsp;strSearch&nbsp;&amp;&nbsp;"']")<br />'</span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;.</span><span style="color: #0000BB">selectSingleNode</span><span style="color: #007700">(</span><span style="color: #DD0000">"//Categories/Ngayden[.='08/12/2011']"</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">Not&nbsp;xNode&nbsp;Is&nbsp;Nothing&nbsp;Then<br /> &nbsp; &nbsp; &nbsp;EditNodes&nbsp;xDoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"//TableCongVanDen/Dong/Soden[.='"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">strSearch&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"']"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;End&nbsp;</span><span style="color: #007700">If<br /></span><span style="color: #0000BB">End&nbsp;With<br />xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">Save&nbsp;strPath<br />Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br />Sub&nbsp;EditNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xDoc&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">xPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;foo&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMNodeList</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">el &nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMElement<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">selectNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xPath</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">.</span><span style="color: #0000BB">Length&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0&nbsp;Then&nbsp;Debug</span><span style="color: #007700">.Print&nbsp;</span><span style="color: #DD0000">"[Sua&nbsp;NoiDung&nbsp;Node:&nbsp;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">xPath<br /> &nbsp; &nbsp;</span><span style="color: #007700">For&nbsp;</span><span style="color: #0000BB">Each&nbsp;el&nbsp;In&nbsp;foo<br /> &nbsp; &nbsp; &nbsp; &nbsp;el</span><span style="color: #007700">.</span><span style="color: #0000BB">Text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"aaaa"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Next&nbsp;el<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub&nbsp;<br /></span></code></div></div></div><br />
<br />
Ngoài các hàm trên mong các bạn chia sẽ thêm nhưng gì còn thiếu.<br />
<br />
<span style="color: #FF30DC;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Tiếp theo tôi sẽ làm các bài liên quan đến tương tác giữa Access file CSV và TXT. </span></span><br />
<br />
Thân mến!]]></description>
			<content:encoded><![CDATA[Đây là những hàm tôi sưu tầm chỉnh sửa lại, các bạn có thể nghiên cứu chi tiết trên web hoặc tại đây: <a href="http://www.functionx.com/vbaccess/Lesson63.htm" target="_blank" rel="noopener" class="mycode_url">Link học XML</a><br />
<br />
<span style="color: #00369B;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">1. Xuất Table sang file XML:</span></span><br />
<div class="codeblock phpcodeblock"><div class="title">Mã PHP:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;TableToXML</span><span style="color: #007700">()</span><span style="color: #0000BB"> &nbsp;</span><span style="color: #DD0000">'Thuoc&nbsp;Modules:&nbsp;Import-Export&nbsp;XML<br /> &nbsp; &nbsp;Application.ExportXML&nbsp;acExportTable,&nbsp;"tblCVDen",&nbsp;"d:&#092;xml3.xml"<br />End&nbsp;Sub&nbsp;<br /></span></code></div></div></div><br />
<br />
<span style="color: #00369B;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">2. Các hàm của tôi Xây dựng: để tương tác với XML (Đã Test chạy ok tất cả)</span></span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">Mã PHP:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;TaoFileXML2</span><span style="color: #007700">()<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;rst&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Recordset<br /> &nbsp; &nbsp;Dim&nbsp;strSQL&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;strSQL&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;SoTT,&nbsp;Ngayden,&nbsp;Soden,&nbsp;Tacgia&nbsp;FROM&nbsp;tblCVDen"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;rst&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentDb</span><span style="color: #007700">.</span><span style="color: #0000BB">OpenRecordset</span><span style="color: #007700">(</span><span style="color: #0000BB">strSQL</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /> &nbsp; &nbsp;strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;<br /> &nbsp; &nbsp;Dim&nbsp;fso&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Object<br /> &nbsp; &nbsp;Set&nbsp;fso&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CreateObject</span><span style="color: #007700">(</span><span style="color: #DD0000">"Scripting.FileSystemObject"</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;<br /> &nbsp; &nbsp;Dim&nbsp;objFile&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Object<br /> &nbsp; &nbsp;Set&nbsp;objFile&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fso</span><span style="color: #007700">.</span><span style="color: #0000BB">CreateTextFile</span><span style="color: #007700">(</span><span style="color: #0000BB">strPath</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">True</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">True</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;<br /> &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;</span><span style="color: #DD0000">"&lt;?xml&nbsp;version='1.0'?&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;</span><span style="color: #DD0000">"&lt;TableCongVanDen&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;</span><span style="color: #007700">Do&nbsp;</span><span style="color: #0000BB">Until&nbsp;rst</span><span style="color: #007700">.</span><span style="color: #0000BB">EOF<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Dong&nbsp;SoTT="&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">""""&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"SoTT"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">""""&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Ngayden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"Ngayden"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Ngayden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Soden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"Soden"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Soden&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;Tacgia&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Fields</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tacgia"</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Tacgia&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;vbTab&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&lt;/Dong&gt;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">vbCrLf<br /> &nbsp; &nbsp; &nbsp; &nbsp;rst</span><span style="color: #007700">.</span><span style="color: #0000BB">MoveNext<br /> &nbsp; &nbsp;Loop<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;objFile</span><span style="color: #007700">.</span><span style="color: #0000BB">Write&nbsp;</span><span style="color: #DD0000">"&lt;/TableCongVanDen&gt;"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;rst</span><span style="color: #007700">.</span><span style="color: #0000BB">Close<br /> &nbsp; &nbsp;Set&nbsp;rst&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br /> &nbsp; &nbsp;Set&nbsp;objFile&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br /> &nbsp; &nbsp;Set&nbsp;fso&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br /> &nbsp; &nbsp;MsgBox&nbsp;</span><span style="color: #DD0000">"Complete"<br /></span><span style="color: #0000BB">End&nbsp;Sub<br /><br /></span><span style="color: #007700">Function&nbsp;</span><span style="color: #0000BB">DocNoiDungXML</span><span style="color: #007700">()<br /></span><span style="color: #DD0000">'&nbsp;Khai&nbsp;bao&nbsp;bien:&nbsp;Kieu&nbsp;ket&nbsp;noi&nbsp;muon<br />'</span><span style="color: #0000BB">Dim&nbsp;objParser&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">Object<br /></span><span style="color: #DD0000">'Set&nbsp;objParser&nbsp;=&nbsp;CreateObject("Microsoft.XMLDOM") &nbsp; &nbsp; &nbsp;'&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #0000BB">Set&nbsp;objParser&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Server</span><span style="color: #007700">.</span><span style="color: #0000BB">CreateObject</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"Microsoft.XMLDOM"&nbsp;</span><span style="color: #007700">)<br /></span><span style="color: #DD0000">'or &nbsp;'</span><span style="color: #0000BB">Dang&nbsp;ky&nbsp;them&nbsp;thu&nbsp;vien</span><span style="color: #007700">:</span><span style="color: #0000BB"> &nbsp;Microsoft&nbsp;XML</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">version&nbsp;3.0 &nbsp; &nbsp;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">provided&nbsp;in&nbsp;Msxml</span><span style="color: #007700">.</span><span style="color: #0000BB">dll<br /></span><span style="color: #DD0000">'&nbsp;Khai&nbsp;bao&nbsp;bien:&nbsp;Kieu&nbsp;ket&nbsp;noi&nbsp;som<br />Dim&nbsp;xDoc&nbsp;As&nbsp;MSXML2.DOMDocument<br />Set&nbsp;xDoc&nbsp;=&nbsp;New&nbsp;MSXML2.DOMDocument<br />Dim&nbsp;strPath&nbsp;As&nbsp;String<br /> &nbsp; &nbsp;strPath&nbsp;=&nbsp;CurrentProject.path&nbsp;&amp;&nbsp;"&#092;CVDenXML.xml"<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;If&nbsp;xDoc.Load(strPath)&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DisplayNode&nbsp;xDoc.childNodes,&nbsp;0<br /> &nbsp; &nbsp; &nbsp; &nbsp;Else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;"Load&nbsp;file&nbsp;that&nbsp;bai"<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'&nbsp;</span><span style="color: #0000BB">Hien&nbsp;thi&nbsp;ma&nbsp;loi<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim&nbsp;strErrText&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim&nbsp;xPE&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">IXMLDOMParseError<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #DD0000">'&nbsp;Lay&nbsp;doi&nbsp;tuong&nbsp;ParseError<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Set&nbsp;xPE&nbsp;=&nbsp;xDoc.parseError<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;With&nbsp;xPE<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strErrText&nbsp;=&nbsp;"Tai&nbsp;lieu&nbsp;XML&nbsp;cua&nbsp;ban&nbsp;khong&nbsp;Load&nbsp;len&nbsp;duoc"&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Do&nbsp;loi&nbsp;sau:"&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Loi&nbsp;#:&nbsp;"&nbsp;&amp;&nbsp;.errorCode&nbsp;&amp;&nbsp;":&nbsp;"&nbsp;&amp;&nbsp;xPE.reason&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Dong&nbsp;#:&nbsp;"&nbsp;&amp;&nbsp;.line&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Vi&nbsp;tri&nbsp;dong:&nbsp;"&nbsp;&amp;&nbsp;.linepos&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Vi&nbsp;tri&nbsp;trong&nbsp;File:&nbsp;"&nbsp;&amp;&nbsp;.filepos&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Nguon&nbsp;van&nbsp;ban:&nbsp;"&nbsp;&amp;&nbsp;.srcText&nbsp;&amp;&nbsp;vbCrLf&nbsp;&amp;&nbsp;_<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Document&nbsp;URL:&nbsp;"&nbsp;&amp;&nbsp;.url<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp;With<br /> &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;strErrText,&nbsp;vbExclamation<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Set&nbsp;xPE&nbsp;=&nbsp;Nothing<br /> &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp;If<br /> &nbsp; &nbsp;Set&nbsp;xDoc&nbsp;=&nbsp;Nothing<br />End&nbsp;Function<br /><br />Sub&nbsp;DisplayNode(ByRef&nbsp;Nodes&nbsp;As&nbsp;MSXML2.IXMLDOMNodeList,&nbsp;ByVal&nbsp;Indent&nbsp;As&nbsp;Integer)<br /><br /> &nbsp;Dim&nbsp;xNode&nbsp;As&nbsp;MSXML2.IXMLDOMNode<br /> &nbsp;Indent&nbsp;=&nbsp;Indent&nbsp;+&nbsp;2<br /><br /> &nbsp;For&nbsp;Each&nbsp;xNode&nbsp;In&nbsp;Nodes<br /> &nbsp; &nbsp; &nbsp;If&nbsp;xNode.nodeType&nbsp;=&nbsp;NODE_TEXT&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;Debug.Print&nbsp;Space(Indent)&nbsp;&amp;&nbsp;xNode.parentNode.nodeName&nbsp;&amp;&nbsp;":&nbsp;"&nbsp;&amp;&nbsp;xNode.nodeValue<br /> &nbsp; &nbsp; &nbsp;End&nbsp;If<br /><br /> &nbsp; &nbsp; &nbsp;If&nbsp;xNode.hasChildNodes&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;DisplayNode&nbsp;xNode.childNodes,&nbsp;Indent<br /> &nbsp; &nbsp; &nbsp;End&nbsp;If<br /> &nbsp;Next&nbsp;xNode<br />End&nbsp;Sub<br /><br />Public&nbsp;Sub&nbsp;XoaNode() &nbsp;'</span><span style="color: #0000BB">Thuoc&nbsp;Modules</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Hoc</span><span style="color: #007700">-</span><span style="color: #0000BB">Import</span><span style="color: #007700">-</span><span style="color: #0000BB">Export&nbsp;XM2<br /> &nbsp; &nbsp;Dim&nbsp;xDoc&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument<br />Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br />Dim&nbsp;strSearch&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /><br />strSearch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2<br />strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;New&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument<br /> &nbsp; &nbsp;xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">validateOnParse&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">False<br /> &nbsp; &nbsp;xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">Load&nbsp;strPath<br /><br /> &nbsp; &nbsp;DeleteNodes&nbsp;xDoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"//TableCongVanDen/Dong[@SoTT='"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">strSearch&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"']"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">Save&nbsp;strPath &nbsp;</span><span style="color: #DD0000">''</span><span style="color: #0000BB">save&nbsp;</span><span style="color: #007700">new&nbsp;</span><span style="color: #0000BB">document<br /> &nbsp; &nbsp;Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br />Sub&nbsp;DeleteNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xDoc&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">xPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;foo&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMNodeList</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">el &nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMElement<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">selectNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xPath</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">.</span><span style="color: #0000BB">Length&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0&nbsp;Then&nbsp;Debug</span><span style="color: #007700">.Print&nbsp;</span><span style="color: #DD0000">"[Xoa&nbsp;Node:&nbsp;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">xPath<br /> &nbsp; &nbsp;</span><span style="color: #007700">For&nbsp;</span><span style="color: #0000BB">Each&nbsp;el&nbsp;In&nbsp;foo<br /> &nbsp; &nbsp; &nbsp; &nbsp;el</span><span style="color: #007700">.</span><span style="color: #0000BB">parentNode</span><span style="color: #007700">.</span><span style="color: #0000BB">removeChild&nbsp;el<br /> &nbsp; &nbsp;Next&nbsp;el<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br /></span><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;TimNoiDungFileXML</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">Dim&nbsp;xDoc&nbsp;</span><span style="color: #007700">As&nbsp;New&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument30<br />Dim&nbsp;xNode&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">IXMLDOMElement<br />Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br />Dim&nbsp;strSearch&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /><br />strSearch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">14<br />strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br />'Try&nbsp;To&nbsp;Load&nbsp;The&nbsp;Document<br />With&nbsp;xDoc<br /> &nbsp; &nbsp;If&nbsp;Not&nbsp;.Load(strPath)&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;"Unable&nbsp;to&nbsp;load"<br /> &nbsp; &nbsp; &nbsp; &nbsp;Exit&nbsp;Sub<br /> &nbsp; &nbsp;End&nbsp;If<br /> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;=&nbsp;.selectSingleNode("//TableCongVanDen/Dong/Soden[.='"&nbsp;&amp;&nbsp;strSearch&nbsp;&amp;&nbsp;"']")<br />'</span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;.</span><span style="color: #0000BB">selectSingleNode</span><span style="color: #007700">(</span><span style="color: #DD0000">"//Categories/Ngayden[.='08/12/2011']"</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">Not&nbsp;xNode&nbsp;Is&nbsp;Nothing&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;Debug</span><span style="color: #007700">.Print&nbsp;</span><span style="color: #0000BB">xNode</span><span style="color: #007700">.</span><span style="color: #0000BB">Text</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">xNode</span><span style="color: #007700">.</span><span style="color: #0000BB">nodeName<br /> &nbsp; &nbsp;End&nbsp;</span><span style="color: #007700">If<br /></span><span style="color: #0000BB">End&nbsp;With<br />Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br /></span><span style="color: #007700">Public&nbsp;</span><span style="color: #0000BB">Sub&nbsp;SuaNoiDungXML</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">Dim&nbsp;xDoc&nbsp;</span><span style="color: #007700">As&nbsp;New&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument30<br />Dim&nbsp;xNode&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">IXMLDOMElement<br /><br />Dim&nbsp;strSearch&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br /><br />strSearch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"222222"<br /></span><span style="color: #0000BB">Dim&nbsp;strPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String<br />strPath&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CurrentProject</span><span style="color: #007700">.</span><span style="color: #0000BB">path&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"&#092;CVDenXML.xml"<br />'Try&nbsp;To&nbsp;Load&nbsp;The&nbsp;Document<br />With&nbsp;xDoc<br /> &nbsp; &nbsp;If&nbsp;Not&nbsp;.Load(strPath)&nbsp;Then<br /> &nbsp; &nbsp; &nbsp; &nbsp;MsgBox&nbsp;"Unable&nbsp;to&nbsp;load"<br /> &nbsp; &nbsp; &nbsp; &nbsp;Exit&nbsp;Sub<br /> &nbsp; &nbsp;End&nbsp;If<br /> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;=&nbsp;.selectSingleNode("//TableCongVanDen/Dong/Soden[.='"&nbsp;&amp;&nbsp;strSearch&nbsp;&amp;&nbsp;"']")<br />'</span><span style="color: #0000BB"> &nbsp; &nbsp;Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;.</span><span style="color: #0000BB">selectSingleNode</span><span style="color: #007700">(</span><span style="color: #DD0000">"//Categories/Ngayden[.='08/12/2011']"</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">Not&nbsp;xNode&nbsp;Is&nbsp;Nothing&nbsp;Then<br /> &nbsp; &nbsp; &nbsp;EditNodes&nbsp;xDoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"//TableCongVanDen/Dong/Soden[.='"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">strSearch&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #DD0000">"']"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;End&nbsp;</span><span style="color: #007700">If<br /></span><span style="color: #0000BB">End&nbsp;With<br />xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">Save&nbsp;strPath<br />Set&nbsp;xNode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />Set&nbsp;xDoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub<br /><br />Sub&nbsp;EditNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xDoc&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">MSXML2</span><span style="color: #007700">.</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">xPath&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">String</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Dim&nbsp;foo&nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMNodeList</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">el &nbsp;</span><span style="color: #007700">As&nbsp;</span><span style="color: #0000BB">IXMLDOMElement<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xDoc</span><span style="color: #007700">.</span><span style="color: #0000BB">selectNodes</span><span style="color: #007700">(</span><span style="color: #0000BB">xPath</span><span style="color: #007700">)<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">If&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">.</span><span style="color: #0000BB">Length&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0&nbsp;Then&nbsp;Debug</span><span style="color: #007700">.Print&nbsp;</span><span style="color: #DD0000">"[Sua&nbsp;NoiDung&nbsp;Node:&nbsp;"&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">xPath<br /> &nbsp; &nbsp;</span><span style="color: #007700">For&nbsp;</span><span style="color: #0000BB">Each&nbsp;el&nbsp;In&nbsp;foo<br /> &nbsp; &nbsp; &nbsp; &nbsp;el</span><span style="color: #007700">.</span><span style="color: #0000BB">Text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"aaaa"<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;Next&nbsp;el<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;Set&nbsp;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Nothing<br />End&nbsp;Sub&nbsp;<br /></span></code></div></div></div><br />
<br />
Ngoài các hàm trên mong các bạn chia sẽ thêm nhưng gì còn thiếu.<br />
<br />
<span style="color: #FF30DC;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Tiếp theo tôi sẽ làm các bài liên quan đến tương tác giữa Access file CSV và TXT. </span></span><br />
<br />
Thân mến!]]></content:encoded>
		</item>
	</channel>
</rss>