N
Norman
Hi there
I want to get the data entry <CREATE_DATE_AND_TIME> </
CREATE_DATE_AND_TIME>
from the root entry of an xml tag using code.
<MMXX_PAYMENTS>
<HEADER>
<SOURCE_SYSTEM>MMXX Ver:2.6.04.02</SOURCE_SYSTEM>
<SOURCE_ORG>PEEL</SOURCE_ORG>
<PURPOSE>Payment Record File</PURPOSE>
<CREATE_DATE_AND_TIME>20071102 14:33:16</CREATE_DATE_AND_TIME>
</HEADER>
</MMXX_PAYMENTS>
There are further tags which import fine.
I just don't know how to capture the header infos? Any help is much
appreciated.
thank you very much in advance.
regards Norman
'I use the following code:
Function Importxml()
Dim objXMLDOM
Dim objNodes
Dim objxmlNode
Dim objNodesHeader
Dim objxmlNodesHeader
Dim objNodesType
Dim objxmlNodeTypeFee
Dim objNodesInstallment
Dim objxmlNodeType
Dim objNodesTypeFee
Dim objxmlNodesTypeFee
Dim Strsql As String, strorg As String, strfilename As String,
strdatetime
Dim objADORS
Dim objADOCnn
Dim rst As DAO.Recordset
Dim db As DAO.Database
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.async = False
objXMLDOM.validateOnParse = False
objXMLDOM.Load sFileName
Set objNodes = objXMLDOM.selectNodes("MMXX_PAYMENTS")
For Each objxmlNode In objNodes
' get the header information
Set objNodesHeader = objxmlNode.selectNodes("Header")
For Each objxmlNodesHeader In objNodesHeader
strorg =
objxmlNodesHeader.selectSingleNode("SOURCE_ORG").nodeTypedValue
strdatetime =
objxmlNodesHeader.selectSingleNode("CREATE_DATE_AND_TIME").nodeTypedValue
Next
' next level
Set objNodesType = objxmlNode.selectNodes("PAYMENTS/
INSTALLMENT_PAYMENT")
For Each objxmlNodeType In objNodesType
With rst
.AddNew
.update
end with
next
next
end function
I want to get the data entry <CREATE_DATE_AND_TIME> </
CREATE_DATE_AND_TIME>
from the root entry of an xml tag using code.
<MMXX_PAYMENTS>
<HEADER>
<SOURCE_SYSTEM>MMXX Ver:2.6.04.02</SOURCE_SYSTEM>
<SOURCE_ORG>PEEL</SOURCE_ORG>
<PURPOSE>Payment Record File</PURPOSE>
<CREATE_DATE_AND_TIME>20071102 14:33:16</CREATE_DATE_AND_TIME>
</HEADER>
</MMXX_PAYMENTS>
There are further tags which import fine.
I just don't know how to capture the header infos? Any help is much
appreciated.
thank you very much in advance.
regards Norman
'I use the following code:
Function Importxml()
Dim objXMLDOM
Dim objNodes
Dim objxmlNode
Dim objNodesHeader
Dim objxmlNodesHeader
Dim objNodesType
Dim objxmlNodeTypeFee
Dim objNodesInstallment
Dim objxmlNodeType
Dim objNodesTypeFee
Dim objxmlNodesTypeFee
Dim Strsql As String, strorg As String, strfilename As String,
strdatetime
Dim objADORS
Dim objADOCnn
Dim rst As DAO.Recordset
Dim db As DAO.Database
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.async = False
objXMLDOM.validateOnParse = False
objXMLDOM.Load sFileName
Set objNodes = objXMLDOM.selectNodes("MMXX_PAYMENTS")
For Each objxmlNode In objNodes
' get the header information
Set objNodesHeader = objxmlNode.selectNodes("Header")
For Each objxmlNodesHeader In objNodesHeader
strorg =
objxmlNodesHeader.selectSingleNode("SOURCE_ORG").nodeTypedValue
strdatetime =
objxmlNodesHeader.selectSingleNode("CREATE_DATE_AND_TIME").nodeTypedValue
Next
' next level
Set objNodesType = objxmlNode.selectNodes("PAYMENTS/
INSTALLMENT_PAYMENT")
For Each objxmlNodeType In objNodesType
With rst
.AddNew
.update
end with
next
next
end function