Xpath and Roku : How to retrieve value

Tags: #<Tag:0x00007f6168f04120> #<Tag:0x00007f6168f0bf88> #<Tag:0x00007f6168f0b970>

Hi,

I am trying to retrieve a value from the XML generated by my roku :
The xml looks like this :

<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:roku-com:device:player:1-0</deviceType>
<friendlyName>LivingRoomRoku</friendlyName>
<manufacturer>Roku</manufacturer>
<manufacturerURL>http://www.roku.com/</manufacturerURL>
<modelDescription>Roku Streaming Player Network Media</modelDescription>
<modelName>Roku 3</modelName>
<modelNumber>4200X</modelNumber>
<modelURL>http://www.roku.com/</modelURL>
<serialNumber>4124D2088862</serialNumber>
<UDN>uuid:04042114-0801-105b-801e-ac3a7a3c1e67</UDN>
<serviceList>
<service>
<serviceType>urn:roku-com:service:ecp:1</serviceType>
<serviceId>urn:roku-com:serviceId:ecp1-0</serviceId>
<controlURL/>
<eventSubURL/>
<SCPDURL>ecp_SCPD.xml</SCPDURL>
</service>
<service>
<serviceType>urn:dial-multiscreen-org:service:dial:1</serviceType>
<serviceId>urn:dial-multiscreen-org:serviceId:dial1-0</serviceId>
<controlURL/>
<eventSubURL/>
<SCPDURL>dial_SCPD.xml</SCPDURL>
</service>
</serviceList>
</device>
</root>

And the code looks like this :
transform(“XPATH”,"//root/device/friendlyName/text()",xml)

But I get nothing (empty value)

I have also tried different things :
transform(“XPATH”,"/root/device/friendlyName",xml)
transform(“XPATH”,"/root/device/friendlyName/text()",xml)

But I still can’t find the correct way to do it.

Could someone help me with the Xpath Syntax ?

Best Regards

You might be interested in Roku Support

There he is using //serial-number for the XPath. You can try //friendlyName or if you want to be more specific maybe try //root/device/friendleName.

Thanks, it seems to work when the XML does not contain the <root> part like in the link you provided.
In my example, it contained this <root> and the //friendleName still won’t work.
Anyway, I used the API urls and it works now.