Apr 7, 2010

More DOM Help

I am still struggling with DOM and parsing. I tried using a loop on my individual project and got a "child not found" error. This baffled me.

The more I worked with the code, I would get other errors. Some of the error were like "Results Expected" and Request not well formed.

Then I tried using the code that my teammate Jeremy had for our Iteration 2 group project. I pulled it in and modified it. I loaded up with no results at all!

I keep trying find a site that will explain how DOM and Simple XML parsing works. I have posted several other sites and now I have another one to add to the list.

Quirksmode has a nice introduction to W3C DOM. It shows a lot of code examples and I have posted a sample from the site:
function test2(val) {
if (document.getElementById && document.createElement)
{
node = document.getElementById('hereweare').parentNode;
node.setAttribute('align',val);
}
else alert('Your browser doesn\'t support the Level 1 DOM');
}

3 comments:

  1. Hey Josette, the little bit I played around with the DOM stuff in Javascript was very frustrating and very counter intuitive. What I eventually did was turn more to the PHP proxy script and used a different series of DOM methods to retrive the information with much less effort and frustration. Good Luck.

    ReplyDelete
  2. I thought parsing was hard in C# but the DOM makes C# look like child's play. I really do not understand why it is so hard to get it to work right. I think it is because is involves so many steps and parent nods and child nods and trees. I am confused right now just talking about it.

    ReplyDelete
  3. DOM is very useful if you get to understand how it works but I think it is really you have to first visually map the structure of your page so you know what exactly you are doing parent and child nodes.For me I always make a DOM tree in order to understand the strucutre and only then do coding.

    ReplyDelete