The Code (cont)
We want to make sure we have a handle on the moreovernews tag. To do this, we call the nodeName property of the mainTag object. The nodeName property will return the name of the element exactly as it appears between the tags. That is,
Once we know we have the moreovernews node, we want to get all the article child nodes out of it. Simple enough.
articleList = mainTag.childNodes;
The childNodes property will return an array of XML Objects which are the child nodes of the original XML Object. In this case, the original XML Object is mainTag. Now we need to loop over them.
//set the dynamic text field to blank so we can write new data to it
content_feed_display = "";
for(i=0;i<%lt%>=articleList.length;i++){
//initialize a couple of variables to hold xml data we want displayed
url = "";
headline_text = "";
if(articleList[i].nodeName.toLowerCase() == "article") {
//we get the child node array beneath the articles, aka the meat and potatoes we are after
elementList = articleList[i].childNodes;
So, we set the dynamic text field to blank, so there is a nice clean slate to put our links. Next, we loop through all of the child nodes returned to articleList. We repeatedly blank out two variables on each pass: url and headline_text.
| » Level Advanced |
|
Added: 2000-12-13 Rating: 9 Votes: 705 |
| » Author |
| No information about the author has been provided |
| » Download |
| Download the files used in this tutorial. |
| Download (44 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!