<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Замена даты в XML]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11869&amp;type=atom" />
	<updated>2016-08-02T14:48:19Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11869</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Замена даты в XML]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106525#p106525" />
			<content type="html"><![CDATA[<div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Могу vbs предложить:</div><div class="fancy_spoiler"><div class="codebox"><pre><code>File = &quot;C:\test_ANSI.xml&quot;

Set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set Reg = New RegExp : Reg.IgnoreCase = True

With FSO.GetFile(File)
	All = .OpenAsTextStream(1).ReadAll
	If Test(All, 1, Date1) And Test(All, 2, &quot;&quot;) Then _
	.OpenAsTextStream(2).Write Reg.Replace(All, &quot;$1&quot; &amp; Date1 &amp; &quot;$3&quot;)
End With

Function Test(Text, Num, DateN)
	Reg.Pattern = &quot;(&lt;date_&quot; &amp; Num &amp; &quot;&gt;)([\d\-]*)(&lt;/date_&quot; &amp; Num &amp; &quot;&gt;)&quot;	
	If Reg.Test(Text) Then Test = 1 : If Num = 1 Then _
	DateN = Reg.Execute(Text)(0).Submatches(1)
End Function</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-08-02T14:48:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106525#p106525</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Замена даты в XML]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106517#p106517" />
			<content type="html"><![CDATA[<p>Добрый день.<br />Есть xml файл, в котором имеются строки вида:<br /></p><div class="codebox"><pre><code>&lt;DATE_1&gt;2016-02-01&lt;/DATE_1&gt; 
&lt;DATE_2&gt;2016-02-11&lt;/DATE_2&gt; 
</code></pre></div><p>Необходимо чтобы вторая дата была равна первой. Даты везде разные. Как сделать замену?<br />Заранее спасибо откликнувшимся.</p>]]></content>
			<author>
				<name><![CDATA[olelucoye]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34097</uri>
			</author>
			<updated>2016-08-02T06:52:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106517#p106517</id>
		</entry>
</feed>
