Try this

/feed/id

feed is the “parent” (start and stop tag)
id is directly under the parent “feed”

This array you are getting appears to be VERY simple… just one parent and a ton 
of “children”
You read from the parent to the child element you want. You can see why being 
able to “pretty up” a more complex flow would be a problem, but the one you’re 
getting is fairly simple.


so to get id

/feed/id

to get title

/feed/title

etc

Ignore the <?xml line


It is helpful if you can get an XML editor that will do “pretty” for you - as 
this will format things so they are more “readable” for this purpose.  Oxygen 
XML is great because you can just type in what you think is the Xpath and it 
will cough up the value (if the path is correct). But it’s also expensive…




> <?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>

to (making it clearer what is parent and child

> <?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>


To get an array of the IDs

> <@ASSIGN NAME=idarray SCOPE=local VALUE="<@ELEMENTVALUE myDom 
> xpath=‘/feed/id’ type=‘array'>">




On Nov 18, 2013, at 5:37 PM, Wayne Irvine <[email protected]> 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.

Reply via email to