Solved

Xpath in Query XML


Badge +1

How can we retrieve Title data through Query XML for below mentioned response. 

 


<d:Title>Project Name</d:Title>
 

icon

Best answer by TomaszPoszytek 17 August 2017, 16:53

View original

11 replies

Userlevel 7
Badge +17

Hi!

Just as simple as "//d:Title"

Regards,

Tomasz

Badge +1

Thank you , Tomasz

Userlevel 5
Badge +9

Hi Kris,

You can also use the following XPath to extract the title:

//*[local-name()='Title']

and the following to extract the ID :

//*[local-name()='ID']

Hope this helps

Badge +1

Hi 

How can we retrieve back values like below mentioned response .

<?xml version="1.0" encoding="utf-8"?><feed xml:base="https://XX.com/XX/_api/" 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" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>13b62e11-6d5c-4572-8dc4-f3123234d89d</id><title /><updated>2017-08-29T15:46:35Z</updated><entry><id>https://xxx/plmpwa/_api/ProjectServer/CustomFields('08db85ba-7f6c-e711-8108-0050569e267b')</id><category term="PS.CustomField" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" href="ProjectServer/CustomFields('08db85ba-7f6c-e711-8108-0050569e267b')" /><title /><updated>2017-08-29T15:46:35Z</updated><author><name /></author><content type="application/xml"><m:properties><d:InternalName>Custom_08db85ba7f6ce71181080050569e267b</d:InternalName><d:Name>Test Name</d:Name></m:properties></content></entry><entry><id>https://xxx/_api/ProjectServer/CustomFields('caaa1091-7f6c-e711-8108-0050569e267b')</id><category term="PS.CustomField" 

We need  Custom_08db85ba7f6ce71181080050569e267b value based on "Test Name" name

 

Thanks

Kris

Userlevel 5
Badge +9

You can use the following XPath: 

//*[local-name()='Name' and .='Test Name']/../*[local-name()='InternalName']

Hope this works

Badge +1

Working , Thank you

Userlevel 5
Badge +9

Great

Badge +2

In my case I am getting 5 items in REST call, I need to get all 5 titles from XML, can yoou help me it?

Userlevel 5
Badge +9

If you use a Query XML action with the following XPath and you store the result in a collection variable, you should get 5 items in the collection variable:

//*[local-name()='Title']

Hope this helps

I tried this, it works if I "Run Now", but if a write the output to a collection it returns the whole string. what am I doing wrong?
I put a pause before this action and it worked fine.

Reply