Working with xml data model
am 17.10.2007 04:19:40 von normanHi there,
I have some code that imports data from an xml file via code to Access
2003. Code works well. I like to make a view modifications.
I like to extract some data from the header and the trailer of the xml
file and need some advice.
the root node = c_payment
next node = Header
next node = Payment/Installed
next node = Payment/Anual
next node = Payment/Manual
next node = Trailer , under each node are the elements found + data.
When referencing the header and or the trailer I don't pick up any
data, Why?
Do I have to use a different object to obtaint the header data or do I
need to reference the node I am opening differently?
I appreciate the any input and like to thank everyone cuntributing.
Kind Regards Norman
Here is the code snipple:
....
Dim objXMLDOM
Dim objNodes
Dim objxmlNode
Dim objNodesHeader
Dim objNodesType
Dim objxmlNodeTypeFee
Dim objNodesInstallment
Dim objxmlNodeType
Dim Strsql As String, strorg As String, strfilename As String,
strdatetime as string
Set objNodes = objXMLDOM.selectNodes("C_PAYMENT")
For Each objxmlNode In objNodes
' get the header information
Set objNodesType = objxmlNode.selectNodes("Header")
For Each objNodesHeader In objNodesType
strorg =
objNodesHeader.selectSingleNode("SOURCE_ORG").nodeTypedValue
strdatetime =
objNodesHeader.selectSingleNode("CREATE_DATE_AND_TIME").node TypedValue
Next
Set objNodesType = objxmlNode.selectNodes("PAYMENTS/
INSTALLMENT_PAYMENT")
For Each objxmlNodeType In objNodesType
With rst
..AddNew
.Fields("ORG_ID") = Mid(fsoFile.Name, 8, 3)
.Fields("Intallment_type") = "INSTALLMENT_PAYMENT"
.Fields("POLICY_NUMBER") =
objxmlNodeType.selectSingleNode("POLICY_NUMBER").nodeTypedVa lue
..update
end with
next
next
....