I've got the following XML code:
<OrganisationInfo>
<NetworkList>
<Network>
<NetworkData>
<RoutingInfoSection>
<ChangeHistory>
<ChangeHistoryItem>
<Date>2013-06-04</Date>
<Description>BLABLABLA</Description>
</ChangeHistoryItem>
<ChangeHistoryItem>
<Date>2013-05-21</Date>
<Description>BLABLABLA</Description>
</ChangeHistoryItem>
</ChangeHistory>
</RoutingInfoSection>
</NetworkData>
</Network>
</NetworkList>
</OrganisationInfo>
I have done a VBScript that is able to read xml files in a directory, get some nodes values and save them to a txt file until now, but i don't want to get all the values in the "Date" Node... This function below saves every value assigned to Operadora and "Alteracao", on "Operadora & ";" & Alteracao"
How can I change my code so it get only the first Date that exists?
Follows the function that works on my code:
Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0") 'Msxml2.DOMDocument / Microsoft.XMLDOM
xmlDoc.Async = "False"
xmlDoc.setProperty "SelectionLanguage", "XPath"
Function ExportaDados
For Each f In fso.GetFolder("C:\Users\f8057612\Desktop\Bancos\Script_Operadoras").Files
If LCase(fso.GetExtensionName(f)) = "xml" Then
xmlDoc.Load f.Path
If xmlDoc.ParseError = 0 Then
For Each OrganisationInfo In xmlDoc.SelectNodes("//OrganisationInfo/OrganisationName")
Operadora = OrganisationInfo.Text
temp = ""
For Each Alteracao_Dir In xmlDoc.SelectNodes("//RoutingInfoSection/ChangeHistory/ChangeHistoryItem/Date")
If Alteracao_Dir.Text <> temp Then
temp = Alteracao_Dir.Text
Alteracao = Alteracao_Dir.Text
objetoSaida_Alteracao.WriteLine Operadora & ";" & Alteracao
End If
temp = Alteracao_Dir.Text
Next
Next
WScript.Echo "Parsing error: '" & f.Path & "': " & xmlDoc.ParseError.Reason
End If
End If
Next
End Function