[Xerte] how to strip out a specific string?

Peter Huppertz peter.huppertz at baselgovernance.org
Sun Apr 12 22:28:09 BST 2009


Hi Ron,

I'm not totally sure how you implement your solution but due to the fact 
that Xerte is mainly a flash generator can't you use the built in flash 
functions to deal with XML?

Like:

xm = new 
XML('<entry><id>tag:search.twitter.com,2005:1483252089</id><published>2009-04-09T12:59:26Z</published><link 
type="text/html" rel="alternate" href="
http://twitter.com/jamesclay/statuses/1483252089"/><title>@ronm123 I meant 
in a browser, via a second projector probably.</title><content 
type="html">&lt;a href="http://twitter.com/ronm123"&gt;@ronm123&lt;/a&gt; 
I meant in a browser, via a second projector 
probably.</content><updated>2009-04-09T12:59:26Z</updated><link 
type="image/png" rel="image" href="
http://s3.amazonaws.com/twitter_production/profile_images/96243182/Photo14_normal.jpg
"/><twitter:source>&lt;a href="http://twitter.com/
"&gt;web&lt;/a&gt;</twitter:source><author><name>jamesclay (James 
Clay)</name><uri>http://twitter.com/jamesclay</uri></author></entry>');
 
trace(xml.firstChild.childNodes[6].attributes.href); 
//http://s3.amazonaws.com/twitter_production/profile_images/96243182/Photo14_normal.jpg

Cheers,

Peter



From:
"RonM" <ronm at mitchellmedia.co.uk>
To:
"'Xerte discussion list'" <xerte at lists.nottingham.ac.uk>
Date:
12.04.2009 20:21
Subject:
[Xerte] how to strip out a specific string?
Sent by:
xerte-bounces at lists.nottingham.ac.uk



Hi all
I've been experimenting with the new module method of creating templates 
and have created a couple of new templates optimised for a specific 
purpose which I’ll happily share with the community once complete. One is 
an optimised  view of twitter feeds but unless I’m mistaken it seems like 
the xml isn't complete for some reason. I can pick up and display the text 
and links etc ok but I can't work out how to access the profile pics. 
Here's an example entry...
 
<entry>
    <id>tag:search.twitter.com,2005:1483252089</id>
    <published>2009-04-09T12:59:26Z</published>
    <link type="text/html" rel="alternate" href="
http://twitter.com/jamesclay/statuses/1483252089"/>
    <title>@ronm123 I meant in a browser, via a second projector 
probably.</title>
    <content type="html">&lt;a href="http://twitter.com/ronm123
"&gt;@ronm123&lt;/a&gt; I meant in a browser, via a second projector 
probably.</content>
    <updated>2009-04-09T12:59:26Z</updated>
    <link type="image/png" rel="image" href="
http://s3.amazonaws.com/twitter_production/profile_images/96243182/Photo14_normal.jpg
"/>
    <twitter:source>&lt;a href="http://twitter.com/
"&gt;web&lt;/a&gt;</twitter:source>
    <author>
      <name>jamesclay (James Clay)</name>
      <uri>http://twitter.com/jamesclay</uri>
    </author>
  </entry>
 
I want to be able to strip out the path to the .jpg e.g. 
http://s3.amazonaws.com/twitter_production/profile_images/96243182/Photo14_normal.jpg
 
But can't work out how to do that. I can access the content of 
<id>,<title> and even <name> but the tag containing the profile pic link 
e.g. <link type=”image/png” doesn’t have a closing tag. Presumably I need 
some kind of function + regular expression - any suggestions?
 
Cheers
Ron_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20090412/741f1f73/attachment.html


More information about the Xerte mailing list