Thanks for the response Beverly. I'm not familiar with namespace(s). How does that effect the XML? If I do some string slicing and remove the <feed....> and </feed> tags before applying to the DOM do you think that would make a difference?
I just tried '/feed/entry/id' and '//entry/id' and got no results. Wayne On 20 Nov 2013, at 3:37 am, BEVERLY VOTH <[email protected]> wrote: > Hey, Wayne, might it be the namespace(s)? > >>> xmlns='http://www.w3.org/2005/Atom' xmlns:app='http://purl.org/atom/app#' >>> xmlns:media='http://search.yahoo.com/mrss/' >>> xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' >>> xmlns:gd='http://schemas.google.com/g/2005' >>> xmlns:yt='http://gdata.youtube.com/schemas/2007' > > - this can be a HUGE factor in extracting the xml for various systems. > > FWIW: the full xPATH should be: /feed/entry/id. I don't know if that gets you > an "array" or not - it might only return the first instance of the value(s). > If you use //entry/id you should get ALL matches, but not knowing if this > gets you the array. I mostly work with XSLT to parse the XML. :) > > > Beverly > > On 18 Nov 2013, at 5:37 PM, Wayne Irvine wrote: > >> I'm trying to parse some feeds from Youtube's API and not having much luck. >> >> The results look like this: >> >> <?xml version='1.0' encoding='UTF-8'?> >> <feed xmlns='http://www.w3.org/2005/Atom' >> xmlns:app='http://purl.org/atom/app#' >> xmlns:media='http://search.yahoo.com/mrss/' >> xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' >> xmlns:gd='http://schemas.google.com/g/2005' >> xmlns:yt='http://gdata.youtube.com/schemas/2007'> >> <id>http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads</id> >> <updated>2013-11-18T21:43:35.006Z</updated> >> <category scheme='http://schemas.google.com/g/2005#kind' >> term='http://gdata.youtube.com/schemas/2007#video'/> >> <title type='text'>Uploads by Brandon Evertz</title> >> <logo>http://www.gstatic.com/youtube/img/logo.png</logo> >> <link rel='related' type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ'/> >> <link rel='alternate' type='text/html' >> href='http://www.youtube.com/channel/UCX-7L4IiiN1PpoNEoFj3rXQ/videos'/> >> <link rel='http://schemas.google.com/g/2005#feed' >> type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads'/> >> <link rel='http://schemas.google.com/g/2005#batch' >> type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads/batch'/> >> <link rel='self' type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads?start-index=1&max-results=25'/> >> <link rel='next' type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads?start-index=26&max-results=25'/> >> <author> >> <name>Brandon Evertz</name> >> <uri>http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ</uri> >> </author> >> <generator version='2.1' uri='http://gdata.youtube.com'>YouTube data >> API</generator> >> <openSearch:totalResults>869</openSearch:totalResults> >> <openSearch:startIndex>1</openSearch:startIndex> >> <openSearch:itemsPerPage>25</openSearch:itemsPerPage> >> >> >> >> <entry> >> <id>http://gdata.youtube.com/feeds/api/videos/dw8EGJGFfzE</id> >> <published>2013-11-18T11:08:57.000Z</published> >> <updated>2013-11-18T11:08:57.000Z</updated> >> <app:control> >> <yt:state name='restricted' reasonCode='limitedSyndication'>Syndication of >> this video was restricted.</yt:state> >> </app:control> >> <category scheme='http://schemas.google.com/g/2005#kind' >> term='http://gdata.youtube.com/schemas/2007#video'/> >> <category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' >> term='Entertainment' label='Entertainment'/> >> <title type='text'>Trailer Princess VIP Party</title> >> <content type='text'>Preview Big Review TV's exclusive interviews of the >> hottest models and the coolest guests at the Princess Torrens luxury yacht >> party.</content> >> <link rel='alternate' type='text/html' >> href='http://www.youtube.com/watch?v=dw8EGJGFfzE&feature=youtube_gdata'/> >> <link rel='http://gdata.youtube.com/schemas/2007#video.related' >> type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/videos/dw8EGJGFfzE/related'/> >> <link rel='self' type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads/dw8EGJGFfzE'/> >> <author> >> <name>Brandon Evertz</name> >> <uri>http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ</uri> >> </author> >> </entry> >> >> <entry> >> <id>http://gdata.youtube.com/feeds/api/videos/FGiypDv_YkU</id> >> <published>2013-11-15T06:58:37.000Z</published> >> <updated>2013-11-15T06:58:37.000Z</updated> >> <category scheme='http://schemas.google.com/g/2005#kind' >> term='http://gdata.youtube.com/schemas/2007#video'/> >> <category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' >> term='People' label='People & Blogs'/> >> <title type='text'>Webcam video from November 15, 2013 5:56 PM</title> >> <content type='text'/> >> <link rel='alternate' type='text/html' >> href='http://www.youtube.com/watch?v=FGiypDv_YkU&feature=youtube_gdata'/> >> <link rel='http://gdata.youtube.com/schemas/2007#video.related' >> type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/videos/FGiypDv_YkU/related'/> >> <link rel='http://gdata.youtube.com/schemas/2007#mobile' type='text/html' >> href='http://m.youtube.com/details?v=FGiypDv_YkU'/> >> <link rel='self' type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads/FGiypDv_YkU'/> >> <author> >> <name>Brandon Evertz</name> >> <uri>http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ</uri> >> </author> >> </entry> >> >> <entry> >> <id>http://gdata.youtube.com/feeds/api/videos/ZxJRl_YHn8E</id> >> <published>2013-11-15T01:23:25.000Z</published> >> <updated>2013-11-15T09:08:28.000Z</updated> >> <category scheme='http://schemas.google.com/g/2005#kind' >> term='http://gdata.youtube.com/schemas/2007#video'/> >> <category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' >> term='News' label='News & Politics'/> >> <title type='text'>Example</title> >> <content type='text'>Example</content> >> <link rel='alternate' type='text/html' >> href='http://www.youtube.com/watch?v=ZxJRl_YHn8E&feature=youtube_gdata'/> >> <link rel='http://gdata.youtube.com/schemas/2007#video.related' >> type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/videos/ZxJRl_YHn8E/related'/> >> <link rel='http://gdata.youtube.com/schemas/2007#mobile' type='text/html' >> href='http://m.youtube.com/details?v=ZxJRl_YHn8E'/> >> <link rel='self' type='application/atom+xml' >> href='http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ/uploads/ZxJRl_YHn8E'/> >> <author> >> <name>Brandon Evertz</name> >> <uri>http://gdata.youtube.com/feeds/api/users/X-7L4IiiN1PpoNEoFj3rXQ</uri> >> </author> >> </entry> >> >> </feed> >> >> I'm assigning to a DOM and then attempting to extract and array to get the >> element count: >> >> <@ASSIGN NAME="myDom" SCOPE="local" VALUE=<@DOM VALUE="@@request$httpData">> >> <@ASSIGN NAME=idarray SCOPE=local VALUE="<@ELEMENTVALUE myDom >> xpath='/entry/id'>"> >> >> I've tried all sorts of things for the xpath: >> /xml/feed/entry/id >> xml/feed/entry/id >> /feed/entry/id >> but all seems to give errors or no results. >> >> Anyone know the correct xpath to extract an array of (for example) IDs? >> >> Wayne Irvine >> w: http://www.byteserve.com.au/ >> p: +61 2 9960 6099 >> m: 0409 960 609 >> >> >> >> >> ---------------------------------------- >> >> To unsubscribe from this list, please send an email to >> [email protected] with "unsubscribe terascript-talk" in the body. >> > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to > [email protected] with "unsubscribe terascript-talk" in the body. > Wayne Irvine w: http://www.byteserve.com.au/ p: +61 2 9960 6099 m: 0409 960 609 ---------------------------------------- To unsubscribe from this list, please send an email to [email protected] with "unsubscribe terascript-talk" in the body.
