First page Back Continue Last page Image

Parsing Server Data

function showPictures() {

var tempText = document.createElement("div");

var theText;

if (xhr.readyState == 4) {

if (xhr.status == 200) {

var allImages = xhr.responseXML.getElementsByTagName("content");

for (var i=0; i<allImages.length; i++) {

tempText.innerHTML = getPixVal(allImages[i]);

theText = tempText.getElementsByTagName("p")[1].innerHTML;

theText = theText.replace(/240/g,"75");

theText = theText.replace(/180/g,"75");

theText = theText.replace(/_m/g,"_s");

document.getElementById("pictureBar").innerHTML += theText;

}

}

else {

alert("There was a problem with the request " + xhr.status);

}

}

function getPixVal(inVal) {

return (inVal.textContent) ? inVal.textContent : inVal.text;

}

}

<entry>

<title>IMG_0042.JPG</title>

<link rel="alternate" type="text/html"

href="http://www.flickr.com/photos/dorismith/882587910/in/set-72157600976524175/"/>

<id>tag:flickr.com,2005:/photo/882587910/in/set-72157600976524175</id>

<published>2007-07-24T05:19:08Z</published>

<updated>2007-07-24T05:19:08Z</updated>

<dc:date.Taken>2007-07-22T13:40:36-08:00</dc:date.Taken>

<content type="html">

&lt;p&gt;

&lt;a href=&quot;http://www.flickr.com/people/dorismith/&quot;&gt;

Dori Smith&lt;/a&gt; posted a photo:

&lt;/p&gt;

&lt;p&gt;

&lt;a href=&quot;http://www.flickr.com/photos/dorismith/882589162/&quot; title=&quot;

IMG_0043.JPG&quot;&gt;&lt;img src=&quot;

http://farm2.static.flickr.com/1179/882589162_25b4d6bcbe_m.jpg&quot;

width=&quot;180&quot; height=&quot;240&quot; alt=&quot;IMG_0043.JPG&quot; /&gt;&lt;/a&gt;

&lt;/p&gt;

</content>

<author>

<name>Dori Smith</name>

<uri>http://www.flickr.com/people/dorismith/</uri>

</author>

<link rel="enclosure" type="image/jpeg"

href="http://farm2.static.flickr.com/1179/882589162_25b4d6bcbe_m.jpg" />

<category term="winery" scheme="http://www.flickr.com/photos/tags/" />

<category term="sonomacounty" scheme="http://www.flickr.com/photos/tags/" />

<category term="sculptures" scheme="http://www.flickr.com/photos/tags/" />

<category term="dorismith" scheme="http://www.flickr.com/photos/tags/" />

<category term="paradiseridge" scheme="http://www.flickr.com/photos/tags/" />

<category term="paradiseridgesculptures" scheme="http://www.flickr.com/photos/tags/" />

</entry>

flickrfeed.xml - snipet

Regular Expression Replacements

Condition True Part False Part From Page 34