I have a xml document that I am using for each to loop through parties. I need to get PartyID
and DateOfBirth
. I am getting PartyID
, but DateOfBirth
is showing 0001-01-01T00:00:00
.
XML Document
<Integration>
<Case>
<CaseEvent Date="06/14/2010" ID="252945068">
<PartyID>9919636</PartyID>
</CaseEvent>
<CaseParty ID="9919636">
<DateOfBirth>04/27/1910</DateOfBirth>
</CaseParty>
</Case>
<IntegrationConditions>
<IntegrationCondition Word="TAWQ" Description="Inserts">
<NotificationEvent notificationType="TAWQ" elementKey="252945068">InsertSomething</NotificationEvent>
</IntegrationCondition>
</IntegrationConditions>
</Integration>
Expected result
<InsertPWBRorAOS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="">
<RelatedParties>
<CaseParty>
<DateOfBirth>04/27/1910</DateOfBirth>
<PartyId>9919636</PartyId>
</CaseParty>
</RelatedParties>
</InsertPWBRorAOS>
Actual result
<InsertPWBRorAOS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="">
<RelatedParties>
<CaseParty>
<DateOfBirth>0001-01-01T00:00:00</DateOfBirth>
<PartyId>9919636</PartyId>
</CaseParty>
</RelatedParties>
</InsertPWBRorAOS>
My VB.NET code
Public Shared Sub ProcessInsertPWBRorAOS(ByRef aobjXmlInputDoc As System.Xml.XmlDocument, ByVal aobjxmlNotificationEventNode As XmlNode)
Dim objInsertPWBRorAOS As MMGService.InsertPWBRorAOS = New MMGService.InsertPWBRorAOS
Dim objCaseParty As MMGService.CaseParty
Dim objxmlEventPartyIDNode As XmlNode
Dim strEventId As String
strEventId = aobjxmlNotificationEventNode.SelectSingleNode("@elementKey").InnerText
objCaseParty = New MMGService.CaseParty()
'Loop through all PartyIDNodes in CaseEvent with ID equal to NotificationEvent's elementKey
For Each objxmlEventPartyIDNode In aobjXmlInputDoc.DocumentElement.SelectNodes("Case/CaseEvent[@ID=" + strEventId + "]/PartyID")
strPartyID = objxmlEventPartyIDNode.InnerText
objCaseParty.PartyId = strPartyID
'DateofBirth
objCaseParty.DateOfBirth = dtmDateOfBirth
objInsertPWBRorAOS.RelatedParties(i) = objCaseParty
i += 1
Next
End Sub