Not sure exactly how to do, I have the XML file being created, but I am
missing a node that should have the other elements as "SUB CHILD" under it -
the file should look like
<?xml version="1.0" encoding="utf-8" ?>
- <ImportPayments>
- <Payment>
<ReceiptType>1</ReceiptType>
<ReceiptMethod>2</ReceiptMethod>
<ReceiptRef>1834</ReceiptRef>
<ReceivedFrom>1</ReceivedFrom>
<AccountNumber>6116242</AccountNumber>
<Amount>191.8</Amount>
<BankAccountID>12</BankAccountID>
<DeclineReinstatement>0</DeclineReinstatement>
</Payment>
</ImportPayments>
But mine looks like - I am missing the PAYMENT Node - can anyone tell me how
to get that added or am i just being totally stupid - I would lean toward
the latter LOL - Below is a copy of the script
<?xml version="1.0" encoding="utf-8" ?>
- <ImportPayments>
<ReceiptType>1</ReceiptType>
<ReceiptMethod>2</ReceiptMethod>
<ReceiptRef>1834</ReceiptRef>
<ReceivedFrom>1</ReceivedFrom>
<AccountNumber>6116242</AccountNumber>
<Amount>191.8</Amount>
<BankAccountID>12</BankAccountID>
<DeclineReinstatement>0</DeclineReinstatement>
</ImportPayments>
Dim xmlDoc, rootEl, p
Dim fieldReceiptType, fieldReceiptMethod, fieldReceiptRef, fieldReceivedFrom
Dim fieldAccountNumber, fieldAmount, fieldBankAccountID,
fieldDeclineReinstatement
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.preserveWhiteSpace = True 'Create a root element and append it to
the document
Set rootEl = xmlDoc.createElement("ImportPayments")
xmlDoc.appendChild rootEl
Set fieldName = xmlDoc.createElement("Payment")
Set fieldReceiptType = xmlDoc.createElement("ReceiptType")
Set fieldReceiptMethod = xmlDoc.createElement("ReceiptMethod")
Set fieldReceiptRef = xmlDoc.createElement("ReceiptRef")
Set fieldReceivedFrom = xmlDoc.createElement("ReceivedFrom")
Set fieldAccountNumber = xmlDoc.createElement("AccountNumber")
Set fieldAmount = xmlDoc.createElement("Amount")
Set fieldBankAccountID = xmlDoc.createElement("BankAccountID")
Set fieldDeclineReinstatement = xmlDoc.createElement("DeclineReinstatement")
fieldReceiptType.Text = "1"
fieldReceiptMethod.Text = "2"
fieldReceiptRef.Text = "1834"
fieldReceivedFrom.Text = "1"
fieldAccountNumber.Text = "6116242"
fieldAmount.Text = "191.8"
fieldBankAccountID.Text = "12"
fieldDeclineReinstatement.Text = "0"
rootEl.appendChild fieldReceiptType
rootEl.appendChild fieldReceiptMethod
rootEl.appendChild fieldReceiptRef
rootEl.appendChild fieldReceivedFrom
rootEl.appendChild fieldAccountNumber
rootEl.appendChild fieldAmount
rootEl.appendChild fieldBankAccountID
rootEl.appendChild fieldDeclineReinstatement
'Add an XML processing instruction
'and insert it before the root element
Set p=xmlDoc.createProcessingInstruction("xml","version='1.0'")
xmlDoc.insertBefore p,xmlDoc.childNodes(0)
'Save the XML file to the c directory
xmlDoc.Save "c:\trash\test.xml"
'Release all object references
Set xmlDoc = nothing
Set rootEl = nothing
Set fieldReceiptType = nothing
Set fieldReceiptMethod = nothing
Set fieldReceiptRef = nothing
Set fieldReceivedFrom = nothing
Set fieldAccountNumber = nothing
Set fieldAmount = nothing
Set fieldBankAccountID = nothing
Set fieldDeclineReinstatement = nothing
Set fieldName=nothing
Set p = nothing