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)