Closed Ziker22 closed 7 years ago
Hey, @Ziker22. That's an extremely non-standard thing to see. But the good news you can do it!
As you are parsing, each item will have lots of extra properties. If we assume an item is named item
, then you'll see that item['rss:@']
(if it's an rss feed) or item['atom:@']
(if it's an atom feed) will be an object of name/value pairs for any attributes of the item. So in your example:
console.log(item['rss:@']['segment']);
// prints "home"
Hope that helps.
Thanks @danmactough, this answer helps me ;)
@danmactough what if my item's properties have extra attributes like:
<item segment="home">
<title anotherAttribute="hello">blah</title>
<link>
blabla.com
</link>
</item>
Any chance to get the anotherAttribute value 'hello' on item.title ?
@clakech yup. same thing: item.title['rss:@']['anotherAttribute']
Hi, Is there a way to get custom xml attributes when promise is resolved ? example
I want to parse segment="home" part
thx in advance