I need to extract specific data from an XML file that looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
- <Transmission xmlns:xalan="- <ImageInfo SubscriberAMI="127100570" DCN="10173100150101" DateRecieved="20100622" AccountNumber="3330972" transmissionType="Send" ClaimEngineKey="201017477202308" ImageType="Claim" MemberSuffix="2" SubscriberSSN="123456789" EDI_Claim_Key="2010062389386201000088" ClaimEngineIdentifier="PRIC">
<ImageName value="10173100150101.tif" />
</ImageInfo>
- <ImageInfo SubscriberAMI="895929369" DCN="10200101450121" DateRecieved="20100719" AccountNumber="3330972" transmissionType="Send" ClaimEngineKey="201020077208151" ImageType="Claim" MemberSuffix="1" SubscriberAMI="987654321" EDI_Claim_Key="2010071996011901001340" ClaimEngineIdentifier="PRIC">
<ImageName value="10200101450121.tif" />
2010072697979101000119" ClaimEngineIdentifier="PRIC">
<ImageName value="10207101810061.tif" />
</ImageInfo>
</Transmission>
I need to extract the DCN, SubscriberSSN, SubscriberAMI, DateRecieved and the ImageName and write them to a text file.
I am having difficulty extracting the ImageName and writing it to the same line in the text file. What do I need to do to get the ImageName value?
Here is my vbscript:
xmlFileName = "p:\cigna_images\test\transmission.xml"
'DOM = Document Object Model
Set xmlDoc = CreateObject("MSXML2.DOMDocument.4.0")
WScript.Echo "Filename=" & xmlFileName
' Validate the document using the MSXML parser.
xmlDoc.load (xmlFileName)
' SelectNodes
set nodelist = xmlDoc.selectNodes("/Transmission/ImageInfo")
For Each node In nodelist
DCN=node.attributes.getnameditem("DCN").value
SubscriberSSN=node.attributes.getnameditem("SubscriberSSN").value
SubscriberAMI=node.attributes.getnameditem("SubscriberAMI").value
DateRecieved=node.attributes.getnameditem("DateRecieved").value
' Imagefile=node.attributes.getnameditem("ImageName").value
'
WScript.Echo DCN & "," & SubscriberSSN & "," & SubscriberAMI & "," & DateRecieved & "," & Imagefile
Next
WScript.Echo "The end"
Thanks for any help in advance.
<?xml version="1.0" encoding="UTF-8" ?>
- <Transmission xmlns:xalan="- <ImageInfo SubscriberAMI="127100570" DCN="10173100150101" DateRecieved="20100622" AccountNumber="3330972" transmissionType="Send" ClaimEngineKey="201017477202308" ImageType="Claim" MemberSuffix="2" SubscriberSSN="123456789" EDI_Claim_Key="2010062389386201000088" ClaimEngineIdentifier="PRIC">
<ImageName value="10173100150101.tif" />
</ImageInfo>
- <ImageInfo SubscriberAMI="895929369" DCN="10200101450121" DateRecieved="20100719" AccountNumber="3330972" transmissionType="Send" ClaimEngineKey="201020077208151" ImageType="Claim" MemberSuffix="1" SubscriberAMI="987654321" EDI_Claim_Key="2010071996011901001340" ClaimEngineIdentifier="PRIC">
<ImageName value="10200101450121.tif" />
2010072697979101000119" ClaimEngineIdentifier="PRIC">
<ImageName value="10207101810061.tif" />
</ImageInfo>
</Transmission>
I need to extract the DCN, SubscriberSSN, SubscriberAMI, DateRecieved and the ImageName and write them to a text file.
I am having difficulty extracting the ImageName and writing it to the same line in the text file. What do I need to do to get the ImageName value?
Here is my vbscript:
xmlFileName = "p:\cigna_images\test\transmission.xml"
'DOM = Document Object Model
Set xmlDoc = CreateObject("MSXML2.DOMDocument.4.0")
WScript.Echo "Filename=" & xmlFileName
' Validate the document using the MSXML parser.
xmlDoc.load (xmlFileName)
' SelectNodes
set nodelist = xmlDoc.selectNodes("/Transmission/ImageInfo")
For Each node In nodelist
DCN=node.attributes.getnameditem("DCN").value
SubscriberSSN=node.attributes.getnameditem("SubscriberSSN").value
SubscriberAMI=node.attributes.getnameditem("SubscriberAMI").value
DateRecieved=node.attributes.getnameditem("DateRecieved").value
' Imagefile=node.attributes.getnameditem("ImageName").value
'
WScript.Echo DCN & "," & SubscriberSSN & "," & SubscriberAMI & "," & DateRecieved & "," & Imagefile
Next
WScript.Echo "The end"
Thanks for any help in advance.