View Single Post
  #1 (permalink)  
Old August 12th, 2019, 01:14 PM
winkimjr2 winkimjr2 is offline
Friend of Wrox
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default How do I find the correct node among many nodes that matches value in strcourt

I am really stuck on this one even though it seems like what I want is simple.
I have ObjXmlSimpleTypeDoc object which have two EnumerationValue nodes. Each of EnumerationValue have child nodes.

I want to find the correct EnumerationValue. To find the correct EnumerationValue node, I use a variable strCourtNCIC. If the value in strCourtNCIC (in this case MN010015J. This value can be some other value) matches a EnumerationValue@code, that is the EnumerationValue node I need.
For this question strCourtNCIC hold a value MN010015J.

How do I do this in VB.NET? My VB.NET code returns Nothing for objXmlEnumerationValueNode even though I am expecting to see the node with @code = MN010015J

Here is the objXmlSimpleTypeDoc object where I need to find EnumerationValue with @code = strCourtNCIC (MN010015J)
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 just get the correct EnumerationValue that matches strCourtNCIC (MN010015J).

Code:
'CourtNCIC 
strCourtNCIC = objXmlMNCISData.DocumentElement.SelectSingleNode("Case/Court/CourtNCIC").InnerText
'Access the CourtLocationTextType simple type. 
objXmlSimpleTypeDoc = Msc.Integration.CourtXml.Library.v4.SimpleType.GetCompanionFile("CourtLocationTextType")

'Get the correct EnumerationValue node that has @code =MN010015J string value
objXmlEnumerationValueNode = objXmlSimpleTypeDoc.SelectSingleNode("/SimpleTypeCompanion/EnumerationValue[@code=" + strCourtORI + "]/@code")
Reply With Quote