What I am trying to do is that inside object objXmlCourtNode there is xml elements whereby ORI in this object is compared to the input xml document ORI.
What I need to do is whenever the xml document ORI matches one in object objXmlCourtNode and the one in objXmlCourtNode has obsoleteDate, then I want to show an error "Invalid ORI"
When the ORI from xml document matches a ORI in object objXmlCourtNode that does not have obsoleteDate, no error is displayed.
How do I do this?
My If statement produces an error whether or not ORI in xml document that matched ORI in object objXmlCourtNode object has obsoleteDate or not.
xml document. This ORI should not produce an error.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<DataExchange>
<OrganizationIdentification>
<ORI>013G</ns3:IdentificationID>
</OrganizationIdentification>
</DataExchange>
xml document. This ORI should produce an error because the ORI is matches in the objXmlCourtNode has obsoleteDate.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<DataExchange>
<OrganizationIdentification>
<ORI>013J</ns3:IdentificationID>
</OrganizationIdentification>
</DataExchange>
Example of objXmlCourtNode for ORI with obsoleteDate and ORI without obsoleteDate
Code:
<?xml version="1.0" encoding="UTF-8"?>
<EnumerationValue>
<ORI>013G</ORI>
</EnumerationValue>
<EnumerationValue obsoleteDate="2002-12-18">
<ORI>013J</ORI>
</EnumerationValue>
My vb.net code
Code:
If Not (objXmlCourtNode.SelectSingleNode("EnumerationValue/@obsoleteDate") Is Nothing) AndAlso (Not (objXmlCourtNode.SelectSingleNode("@obsoleteDate").InnerText Is Nothing)) Then
Else
("Invalid ORI")
Exit Sub
End If