0

I've been trying to get the xpath of <Name> but with no luck! The webservice return the below XML and we know its an array of values.

<ArrayOfSample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="servername">
  <sample>
   <ID>788999</ID>
   <Name>Employee Name</Name>
  </sample>
</ArrayOfSample>

I've tried some tools for XPath builder but its not working.

ShB
  • 319
  • 2
  • 5
  • 15

1 Answers1

1

Your target element resides in namespace http://hqjed-sql01/. You need to define a prefix, say p, that reference that namespace and use the prefix in the XPath :

//p:Name

Or you can ignore the namespace by using local-name() :

//*[local-name()='Name']
har07
  • 88,338
  • 12
  • 84
  • 137
  • 1
    Correct, of course, (+1) but I closed question as a duplicate of a XPath namespace question with a comprehensive answer including how to set namespace prefixes in multiple languages. – kjhughes May 16 '17 at 12:29