I need to get the url of the second url attribute.
imagesXML.channel.item.count() works but media@content or media.content@url wont. media:content@url is invalid syntax (of course). I cannot change the XML.
You’ll need to user getNamedElement() to get nodes with namespaces. You may need to break it into multiple statements, but something like this should work:
“TheEndless” wrote:
You’ll need to user getNamedElement() to get nodes with namespaces. You may need to break it into multiple statements, but something like this should work:
Actually can do it even simpler, because ifXMLList supports getNamedElements() just like ifXMLElement does (i.e. no need to zero-in on the exact element just yet)
But then will still have to add [idx]@url for the specific attribute as needed - because GetAttributes() does not work the same way for ifXMLList, so one cannot do
xml.channel.item.getNamedElements("media:content").getAttributes().url 'No good
xml.channel.item.getNamedElements("media:content")@url 'No good
'but this will do
xml.channel.item.getNamedElements("media:content")[idx]@url 'OK with single row
I like to give credit to roXML when it deserves it: it has some… affordances