Not able to fetch one item from RSS Feed XML file - XML Namespace

I am able to fetch Title, Description But not able to fetch image Url , media:thumbnail url.

I fetched Title using this expression inside for each , item.Descendants(“title”).First .

XML File:
https://www.wired.com/feed/rss

@sachinns
the prefix media has no corresponding namespace declaration which we can use.
You can try to do it with the local name only
Have a look here:

Another option could be to add the ommited namespace definitions to the xDoc after deserializing the xml. Then with common syntax for namespace and element name the elements can be adressed.

I would suggest to start first with the local name approach.
For more complex retrieval we can help on the namespace approach.

Let us know your feedback

@ppr

I guess i am getting error with the first approach.

XML.txt (237 Bytes)

Can you help me by providing the expression to fetch media:thumbnail url .

are you interested on all media:thumbnail urls?
is the xml read in into a xDoc by the deserialize XML activity?

Yes, i am taking all media:thumbnail using For each activity . xml is read by HTTP Request and then deserialize XML.

give a try on
YourXDocVar.Root.Descendants().Where(Function (x) x.Name.toString.EndsWith(“thumbnail”)).toList

it should return a list of XElements of all thumbnail nodes.

If it is not working at the first shot, let me know I will have a look on later

It is throwing error. I am attaching my xaml file. Main.xaml (18.2 KB)

As mentioned I will have a look on it found some part that I want to check. Give me some time

Sure. Thanks for the fast reply.

@sachinns
looking at the returned RSS Data I encountered that the namespace definitions are returned. So it differs from rss returned by the Link. However it made it more clear to the implementation

media:thumbnail - the element thumbnail is defined under a particual namespace with the prefix media

adding a variable of type XNamespace with the namespace value allows to access the element thumbail with following syntax:

grafik

as mentioned working with local name would look like this:
grafik

and with XPath / local name approach it looks like this:

find the reworked xaml here:
Main_V2.xaml (20.4 KB)

1 Like

Thank you. It worked. :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.