A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Search XML via EX4 and descendants

  1. #1
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813

    resolved [RESOLVED] Search XML via EX4 and descendants

    AS: 3.0 | Platform: Flex 3

    I've been trying to figure this out for hours now and I've unable to decipher how to either correct or workaround this problem. Let me bring you up to speed. My user is doing a search, through a Tree component. To maintain the speed of the app, I convert the dataprovider to XML using the SimpleXMLEncoder (Of course this could be the start of my fall). Anyway, I have a list similar to this:

    Code:
    <root>
        <source>
    	<item>
    	    <children></children>
    	    <description />
    	    <folder>true</folder>
    	    <itemid>123</itemid>
    	    <itemname>Some name here</itemname>
    	    <link>/blah/blah/blah.aspx</link>
    	    <parentid>1</parentid>
    	</item>
        </source>
    </root>
    Okay, if you notice SOME of the nodes may contain children. If that is the case, I would like the search to check those children and the grandchildren, and great grandchildren is any. So I've been trying to figure out the best method to perform this. Unfortunately, I haven't deviced a way to actually do it.

    I will need to be able to search the itemname and the parentid. So when I was using the descendant function I was doing this:

    actionscript Code:
    xmlList = xml.descendants().(itemname.toString().toLowerCase() == searchParam.toLowerCase());

    However using this method, it would never return a value, even though I know the value I am searching for is within the XML variable. So with that failure, I've decided to manually zoom through the XML to find what I am looking for. I am using a FOR LOOP to accomplish this. This is what I have so far:

    actionscript Code:
    for(var i:int = 0; i < xmlDoc.source.item.length(); i++)
    {
        var xmNode:XMLList = xmlDoc.source.item[i];

        /*** HOW SHOULD I SEARCH THIS NOW ****/
    }

    This is where I need some assistance. If anyone has a clue or suggestion, please let me know.
    Last edited by samac1068; 02-23-2011 at 03:49 PM.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    Nevermind, I was able to figure it out.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

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