Nov 4, 2009

Iteration 2

Well i had a horrible time but i finally got my Xml pass through to work. It looks horrible but i can spend time later to gussy it up. I had great difficulty trying to follow the example the professor had set before us. It took several hours but i realized i was looking at the wrong example first. I had started with the finished model. Several pieces of code threw me in several directions.

function formatFeed(xml){
var html = "";
var thisEntry = xml.documentElement.getElementsByTagName("entry");

for (i=0; i
" + unescape(tagval(thisEntry.item(i), "content")) + "

";
}
}
return html;
}

The previous piece of code took me forever to decipher and i still have questions. From what i can tell its a loop that looks at the author you have chosen, selects them from the blog list and then displays their name and latest post.

This was throwing off any time of output i wanted on my screen and instead had to change the display function to the follwing:

function displayDetails() {
if (request.readyState == 4) {
if (request.status == 200) {
document.getElementById("content").innerHTML = request.responseXML;
}
}
}

This finally got the XML information to display unformatted on my page.

6 comments:

  1. Maddox,

    I felt your pain too! Your not alone, many (if not all) were there or may still be. I even had a secondary bout of the pain when my code i thought was working, ended up failing when i went back for further testing. All is good now though

    ReplyDelete
  2. I am having the same troubles still. I feel like I have gotten my code correct, but when I check it it does not work. I have spent hours trying to do the simplest of tasks and not always understanding what it is I have wrong.

    ReplyDelete
  3. the second part of the code i have above puts the xml info in the the "content" variable.

    on your site you have to create a DIV tag within the body to have that data be displayed.

    ReplyDelete
  4. Maddox,
    Just so you know, you are not alone ... I too have felt my frustration level rise after spending an enormous amount of time reviewing the samples provided and still not being able to get my program to run successfully. Sometimes it is helpful to search the web for more examples so you get a better understanding of what is needed. If you continue working through the examples, and achieve the end result, it will definitely make much more sense to you and give you such a good feeling that you finally accomplished your goal. Hang in there....you can do it!

    ReplyDelete
  5. Dude I wished someone told me this a few days ago. It would have made my weekend so much better.

    ReplyDelete
  6. I'm right there with you trying to make all of these things work and display as I want them to. Sometimes my eyes start bugging out from looking at the computer for hours. It seems the way to learn what works is through trial and error.

    ReplyDelete