Results 1 to 2 of 2

Thread: How do I add node values from one document into another?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2013
    Posts
    43

    How do I add node values from one document into another?

    I have been stuck on this one for days. I hope to get help from you great people.

    What I am trying to do in VB.NET is use a variable named strCourtNCIC to hold a value. Then I want to use the strCourtNCIC value to look inside object objXmlSimpleTypeDoc and find an EnumerationValue node that have @code value that matches the value in strCourtNCIC variable.

    In this question strCourtNCIC = MN010015J. This can be a different value but I already got the value from some other document.

    After I find the correct EnumerationValue node, I want to get the values for children and add them to my objXmlResponseDoc. The result should look like the one I posted here.

    The objXmlResponseDoc should look like this

    Code:
    <GetCaseInformationResponseMessage>
        <CourtLocation>
            <CourtName>Emily</CourtName>
            <ORINumber>MN010015J</ORINumber>
            <MNCISNodeID>111</MNCISNodeID>
            <PhoneNumber>724-820-7123</PhoneNumber>
        </CourtLocation>
    </GetCaseInformationResponseMessage>


    Here is the objXmlSimpleTypeDoc that need to get the EnumerationValue with @code that matches strCourtNCIC value (MN010015J). Then get value for CountyName, ORINumber, MNCISNodeID and PhoneNumber then add them to my new object named objXmlResponseDoc.

    Code:
    <SimpleTypeCompanion enumerates="CourtLocationTextType">
    	<EnumerationValue code="MN010015J">
    		<Text>Emily County</Text>
    		<AssociatedValue type="MNCISNodeID">
    			<Text>111</Text>
    		</AssociatedValue>
    		<AssociatedValue type="CountyName">
    			<Text>Emily</Text>
    		</AssociatedValue>
    		<AssociatedValue type="PhoneNumber">
    			<Text>724-820-7123</Text>
    		</AssociatedValue>
    	</EnumerationValue>
    	<EnumerationValue code="DC19DAKDC">
    		<Text>Pope County</Text>
    		<AssociatedValue type="MNCISNodeID">
    			<Text>112</Text>
    		</AssociatedValue>
    		<AssociatedValue type="CountyName">
    			<Text>Pope</Text>
    		</AssociatedValue>
    	</EnumerationValue>
    </SimpleTypeCompanion>
    Here is the VB.NET code that I need help with to add the node values from correct EnumerationValue node.

    Code:
    'Produce the response message
    objXmlResponseDoc = New XmlDocument
    objXmlResponseDoc.AppendChild(objXmlResponseDoc.CreateElement("GetCaseInformationResponseMessage"))
    objXmlMNCISData = Library.v4.Case.GetIxmlForCaseNumber(strCaseNumber, "CourtCaseHeaderGroup", False)
    'CourtNCIC = MN010015J
    strCourtNCIC = objXmlMNCISData.DocumentElement.SelectSingleNode("Case/Court/CourtNCIC").InnerText
    'New CourtNCIC as xml element
    objXmlCourtNCICElement = objXmlMNCISData.DocumentElement.SelectSingleNode("Case/Court/CourtNCIC")
    'Access the CourtLocationTextType simple type. 
    objXmlSimpleTypeDoc = Msc.Integration.CourtXml.Library.v4.SimpleType.GetCompanionFile("CourtLocationTextType")
    'Court location
    objXmlCourtLocationNode = objXmlResponseDoc.CreateElement("CourtLocation")
    objXmlResponseDoc.DocumentElement.AppendChild(objXmlCourtLocationNode)
    'CourtName
    objXmlCourtNameElement = objXmlResponseDoc.CreateElement("CourtName")
    strCourtName = objXmlCourtLocationNode.SelectSingleNode("EnumerationValue[@code=" + strCourtNCIC + "]/Test").InnerText
    objXmlCourtLocationNode.AppendChild(objXmlCourtNameElement)
    'ORINumber
    objXmlORINumberElement = objXmlResponseDoc.CreateElement("ORINumber")
    objXmlCourtLocationNode.AppendChild(objXmlORINumberElement)
    'MNCISNode ID
    objXmlMNCISNodeIDElement = objXmlResponseDoc.CreateElement("MNCISNodeID")
    objXmlCourtLocationNode.AppendChild(objXmlMNCISNodeIDElement)
    'PhoneNumber 
    objXmlPhoneNumberElement = objXmlResponseDoc.CreateElement("PhoneNumber")
    objXmlCourtLocationNode.AppendChild(objXmlPhoneNumberElement)

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    Re: How do I add node values from one document into another?

    So what's the question? What part are you having an issue with?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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