A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Display only some XML nodes

Hybrid View

  1. #1
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    thes reason you can see the tags is because you have to define the textfield as html when loading stuff so

    myText.text = ksmContent;

    would become

    myText.htmlText = ksmContent;
    Evolve Designs Interactive Media
    the natural selection

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Ok I ended up making a little code that reads the newest digg from digg.com and traces it out, I think it may help you understand how this works


    Code:
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("http://digg.com/rss/index.xml");
    
    function loadXML(success) {
    	if (success) {
    		parseXML();
    	}
    	else {
    		trace("Oh noes! Digg is dead!");
    	}
    }
    
    function parseXML(){
    	story = xmlData.firstChild.firstChild.childNodes;
    	titles = story[4].childNodes[0].childNodes;
    	link = story[4].childNodes[1].childNodes;
    	description = story[4].childNodes[2].childNodes;
    	pubDate = story[4].childNodes[3].childNodes;
    	digCount = story[4].childNodes[5].childNodes;
    	category = story[4].childNodes[7].childNodes;
    	commentsCount = story[4].childNodes[8].childNodes;
    	newestDigg = "<b><a href='" + link + "'>" + titles + "</a></b>\r\r" + description + "\r\r" + pubDate + " :: " + "digg count:" + digCount + "\rcategory: " + category + " :: " + "comments count: " + commentsCount;
    	trace(newestDigg);
    	digg_txt.htmlText = newestDigg;
    }
    I found the path in the xml to all the <items></items> which are the containers for each of the stories, then named that 'story' in the above code. I then dug into each story to separate all the various elements, note the number beside the first childNodes, each one represents one of the elements in the story array. If i wanted to view a different story all together i would change all the 4's beside story to say 7 then it would trace out the the info from a different <item> node.

    I think if you check out the xml im calling on digg beside the above code you should get the idea. (or jsut be totally confused by all this information lol)

    good luck!
    Evolve Designs Interactive Media
    the natural selection

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center