0

Hey guys I wanted to know whats the xpath needed to get all the attribute values which have a specific name:I need the values of the attribute "code": eg:

<nsIdentiftcustBuss:BusinessAddress>
<nsCommon:AddressType
   code="12">TRADING</nsTCVCommon:AddressType>
  <nsCommon:AddressLine1>SAN SUI HOUSE</nsCommon:AddressLine1>
  <nsCommon:AddressLine2>KHARADI</nsCommon:AddressLine2>
  <nsCommon:AddressLine3>KALYANI NAGAR</nsCommon:AddressLine3>
  <nsCommon:AddressLine4>QUADRON</nsCommon:AddressLine4>
  <nsCommon:City>NEW YORK</nsCommon:City>
  <nsCommon:ZipPostalCode>GDU 87H</nsCommon:ZipPostalCode>
  <nsCommon:Country
   code="76">UNITED KINGDOM</nsCommon:Country>
 </nsIdentiftcustBuss:BusinessAddress>
 <nsIdentiftcustBuss:BusinessAddress>
  <nsCommon:AddressType
   code="11">REGISTERED</nsCommon:AddressType>
  <ns:AddressLine1>104,parkways</nsCommon:AddressLine1>
  <nsCommon:AddressLine2>lincoln street</nsCommon:AddressLine2>
  <nsCommon:AddressLine3>63 avenue</nsCommon:AddressLine3>
  <nsCommon:AddressLine4>manhattan</nsCommon:AddressLine4>
  <nsCommon:City>Northampton</nsCommon:City>
  <nsCommon:ZipPostalCode>NNS 47L</nsCommon:ZipPostalCode>
  <nsCommon:Country
   code="76">UNITED KINGDOM</nsCommon:Country>
 </nsIdentiftcustBuss:BusinessAddress>

I need the output of the attribute name country code of both the nodes Here's the xpath I used this

/*:BusinessAddress/*:Country/(@code)

and I got the output as

 code, 76
 code, 76

But I need only the values:

 76
 76
java
  • 11
  • 3

1 Answers1

0

Try with out brackets @coade.

ex:-

/*:BusinessAddress/*:Country/@code
Supun Perera
  • 89
  • 1
  • 10