Results 1 to 3 of 3

Thread: How do I add value of a xml node?

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2013
    Posts
    43

    How do I add value of a xml node?

    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
    Code:
    <Integration>
    	<IntegrationConditions>
    		<IntegrationCondition Word="Something" Description="Nothing"/>
    	</IntegrationConditions>
    	<!--Add the case elements here.-->
    </Integration>
    Here is the objXMLPartyIDValueDoc which contains two cases. Sometimes there will be only one case. sometimes there will be many cases.
    objXMLPartyIDValuesDoc with two cases.
    Code:
    <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>
    Expected result should look like this
    Code:
    <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>
    My incomplete vb code
    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
    Last edited by winkimjr2; Nov 10th, 2016 at 12:59 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width