-1

I am trying to parse through the below XML and get the value of attribute "RefNum". I used the both XPath but still no luck.

  1. //*[local-name()='ExternalBidAward']/[@RefNum]/text()
  2. //*[local-name()='ExternalBidAward'][@RefNum]/text()
<?xml version="1.0" encoding="UTF-8"?>
<ExternalBidAward
    BidAwardType="INITIAL"
    ContractRefNum="1111"
    ContractType="GPO"
    CustRealmNum="1024"
    CustomerRefNum="1234566"
    CustomerRefType="CUST"
    StartDate="2016-01-01 00:00:00"
    EndDate="2018-10-11 23:59:59"
    PubDate="2018-10-11 17:32:22"
    RunDate="2018-10-11 17:30:02"
    PubRefNum="00001111111"
    RefNum="0028383101"
    >
  </ExternalBidAward>
halfer
  • 18,701
  • 13
  • 79
  • 158
user297222
  • 111
  • 2
  • 5
  • Why are you using this construct, `*[local-name()='ExternalBidAward']` ? – kjhughes Oct 16 '18 at 21:58
  • 1
    Possible duplicate of [Extract value of attribute node via XPath](https://stackoverflow.com/questions/4835891/extract-value-of-attribute-node-via-xpath) – Andersson Oct 17 '18 at 04:08

1 Answers1

0

If no namespace is involved:

/ExternalBidAward/@RefNum

Should get you what you want.

Markus
  • 2,963
  • 2
  • 18
  • 27