on 06-23-2016 3:01 PM
Hi guys,
I am polling a REST api with an incremental request. The incremental token is in the response content, which is actually an Atom feed.
Truth is, I couldn't figure the XPath expression to the token...
Here is the response :
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://some.server/SomeService.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>https://some.server/SomeService.svc/SomeCollection</id>
<title type="text">SomeCollection</title>
<updated>2016-06-23T09:30:57Z</updated>
<link rel="self" title="SomeCollection" href="SomeCollection" />
<entry>
...
</entry>
</feed>
Willing to get the "updated" node, I tried a few possibilities :
In each case, the next call used the fallback value for "missing of empty token".
So, who can tell me the correct XPath expression ?
Bonus points for the one who will explain me why my first two guesses were not successful...
Thanks in advance,
Manu.
Hi Manu,
I just tested XPATH for your payload in this online tool:
Free Online XPath Tester / Evaluator - FreeFormatter.com
and noticed that the namespace definition part xmlns="http://www.w3.org/2005/Atom" is calling the problem. I get this error in the tool: "The default (no prefix) Namespace URI for XPath queries is always '' and it cannot be redefined to 'http://www.w3.org/2005/Atom'."
Replace this with
xmlns:n="http://www.w3.org/2005/Atom in the tool and I can get the data using XPATH: //feed/updated.
Regards,
Sanjeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manu,
Sorry, just realised that namespace declaration is default namespace.
Try assigning a prefix to this namespace in XPATH expression and then provide the xpath with that prefix.
Regards,
Sanjeev
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.