1

I'm having some issues with my xpath queries in c#..

Given the xml of :

<BlahApi xsi:schemaLocation="https://api.blah.com/xsd/blah.xsd" Version="0.0.0.0" xmlns="Blah.Api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Status Code="0" Message="Success" NextID="0" NextCallTime="" />
    <ValidateCustomerAccountNumber>
        <Customer Name="Blah" ID="00000000-0000-0000-0000-000000000000" ApiToken="blah" ProfileId="blah" AdminEmail="blah@blah.com" CustomerEmail="" />
    </ValidateCustomerAccountNumber>
</BlahApi>

And code of:

var customerId = step1Response.XPathEvaluate("/BlahApi/ValidateCustomerAccountNumber/Customer/@ID");

I would expect to get the GUID for the Id back. But its empty. I've tried stripping this down to just a / and I get the whole document, but if I try to even do : "/BlahApi" it evaluates to nothing.

Not sure what I"m doing wrong. Thanks in advance.

Wjdavis5
  • 3,952
  • 7
  • 35
  • 63
  • 1
    Sounds like a namespace mismatch – Bob Vale Oct 12 '17 at 21:55
  • If you're using the same xpath implementation, this might help: https://stackoverflow.com/questions/585812/using-xpath-with-default-namespace-in-c-sharp#585822 – Gus Oct 12 '17 at 21:58

0 Answers0