Link to home
Start Free TrialLog in
Avatar of nap0leon
nap0leon

asked on

Classic ASP XPath select parent node where child node has certain text

In Classic ASP I have an XML document loaded into a session variable session("ArrayOfInformation")
I have available to me the PartnerUid.
I need to find out:
1- Is there a node in the XML where the PartnerUid is what I am looking for
2- If there is such a node, I need the DsiplayName and the DirectoryName

If someone can point me to the appropriate XPATH so that I can run selectSingleNode on the "Information" node that contains the child node I am looking for, I can get to the two values I am looking for.

<ArrayOfInformation>
  <Information>
    <PartnerId>12345</PartnerId>
    <Description>Description Here</Description>
    <DirectoryName>Directory Name Here</DirectoryName>
    <PartnerUid>54321</PartnerUid>
    <DisplayName>Display Name Here</DisplayName>
  </Information>
  <Information>
    <PartnerId>67890</PartnerId>
    <Description>Description Here</Description>
    <DirectoryName>Directory Name Here</DirectoryName>
    <PartnerUid>098765</PartnerUid>
    <DisplayName>Display Name Here</DisplayName>
  </Information>
</ArrayOfInformation>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of BigRat
BigRat
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nap0leon
nap0leon

ASKER

I went the XPATH route

objXML.selectSingleNode("//ArrayOfInformation[PartnerUid='" & PartnerUID & "']")
The posting "I went the XPath route" corresponds to my suggestion.
The posting "I went the XPath route" corresponds to my suggestion.