Basically what I want to do is add objXMLPartyIDValuesDoc Case/s to aobjXmlInputDoc after the IntegrationConditions element
I would like to loop through each Case in objXMLPartyIDValuesDoc and then append Case to aobjXmlInputDoc after IntegrationConditions element.
I know I have to use import and append but I am not sure how.
Here is the aobjXMLInputDoc and is where I want to add the Case/s after IntegrationConditions element.
aobjXmlInputDoc
Here is the objXMLPartyIDValueDoc which contains two cases. Sometimes there will be only one case. sometimes there will be many cases.Code:<Integration> <IntegrationConditions> <IntegrationCondition Word="Something" Description="Nothing"/> </IntegrationConditions> <!--Add the case elements here.--> </Integration>
objXMLPartyIDValuesDoc with two cases.
Expected result should look like thisCode:<Cases> <Case> <Court> <NodeID>8</NodeID> </Court> <CaseType Word="XYZ">Something</CaseType> <BaseCaseType>Adult</BaseCaseType> <CaseCategory>CR</CaseCategory> <Connection Word="VIC" BaseConnection="VI">Victim</Connection> </Case> <Case> <Court> <NodeID>01</NodeID> </Court> <CaseType Word="DFT">Default Judgment</CaseType> <BaseCaseType>Bond Forfeiture</BaseCaseType> <CaseCategory>CV</CaseCategory> <Connection Word="PLN" BaseConnection="PL">Plaintiff</Connection> </Case> </Cases>
My incomplete vb codeCode:<Integration> <IntegrationConditions> <IntegrationCondition Word="Something" Description="Nothing"> </IntegrationCondition> </IntegrationConditions> <Cases> <Case> <Court> <NodeID>8</NodeID> </Court> <CaseType Word="XYZ">Something</CaseType> <BaseCaseType>Adult</BaseCaseType> <CaseCategory>CR</CaseCategory> <Connection Word="VIC" BaseConnection="VI">Victim</Connection> </Case> <Case> <Court> <NodeID>01</NodeID> </Court> <CaseType Word="DFT">Default Judgment</CaseType> <BaseCaseType>Bond Forfeiture</BaseCaseType> <CaseCategory>CV</CaseCategory> <Connection Word="PLN" BaseConnection="PL">Plaintiff</Connection> </Case> </Cases> </Integration>
Code:'Run SQL query uaing function GetCaseSQL Dim strSql As String = GetCaseSQL(aobjXmlInputDoc.DocumentElement.SelectSingleNode("/Integration/PartyMerge/TargetInternalPartyID").InnerText) 'Query Justice database using the query strSql Dim objXMLPartyIDValuesDoc As XmlDocument = Msc.Integration.Mncis.Library.v4.Odyssey.QueryDB(strSql, "Justice", False, True) 'Loop through each case in objXMLPartyIDValuesDoc Dim CaseNode As XmlNodeList = objXMLPartyIDValuesDoc.SelectNodes("Cases/Case") 'For Each 'Code Add case to aobjXmlInputDoc 'Next


Reply With Quote


