2 Replies Latest reply on Feb 24, 2009 3:55 PM by Newsgroup_User

    e4x detecting one attribute, but not another..

    YorFlexGuy
      I'm trying to search an e4x xml structure for a node, and pull that node out. If there were duplicate nodes, then more than one would be pulled, which is why myXML..stat.(@id == someValue) should output an XMLList.

      But this seems to pull my records only when there are more than one record. If there is only 1 record it won't pull anything unless target something within that record. Is it not possible to have an XMLList with only 1 node?
        • 1. Re: e4x detecting one attribute, but not another..
          Gregory Lafrance Level 6
          I think in that case it returns XML, not XMLList.
          • 2. Re: e4x detecting one attribute, but not another..
            Level 7

            "YorFlexGuy" <webforumsuser@macromedia.com> wrote in message
            news:go1sgu$o3d$1@forums.macromedia.com...
            > Hey everybody,
            >
            > I don't know if i'm just missing something obvious, but this isn't making
            > sense to me..
            >
            > Here is my xml:
            >
            > if i search using @Units, it finds nodes, but if i search using @StatID,
            > it
            > doesn't. I tried searching for both a string version and number version of
            > @StatID but it doesn't seem to make any difference.
            >
            > Can anybody shed some light on this? are the slashes in my Date attribute
            > breaking the xml parsing somehow?
            >
            >
            > <stats>
            > <stat StatID="1" Value="400" TextValue="" ProductID="-1" TypeID="1"
            > Date="1/15/2009 12:00:00 AM" IsActive="1" StatName="Weight"
            > Units="Pounds"/>
            > <stat StatID="5" Value="300" TextValue="" ProductID="-1" TypeID="1"
            > Date="1/20/2009 12:00:00 AM" IsActive="1" StatName="Weight"
            > Units="Pounds"/>
            > <stat StatID="6" Value="310" TextValue="" ProductID="-1" TypeID="1"
            > Date="1/23/2009 12:00:00 AM" IsActive="1" StatName="Weight"
            > Units="Pounds"/>
            > <stat StatID="7" Value="250" TextValue="" ProductID="-1" TypeID="1"
            > Date="2/1/2009 12:00:00 AM" IsActive="1" StatName="Weight"
            > Units="Pounds"/>
            > <stat StatID="8" Value="240" TextValue="" ProductID="-1" TypeID="1"
            > Date="2/5/2009 12:00:00 AM" IsActive="1" StatName="Weight"
            > Units="Pounds"/>
            > <stat StatID="9" Value="244" TextValue="" ProductID="-1" TypeID="1"
            > Date="2/10/2009 12:00:00 AM" IsActive="1" StatName="Weight"
            > Units="Pounds"/>
            > </stats>
            >
            > trace("TEST2:" + bmiData..stat.(@Units == "Pounds"));
            > //Outputs the entrie data structure (correct)
            >
            > trace("TEST1:" + bmiData..stat.(@StatID == "8"));
            > //This should pull one of the nodes, out, but instead it finds nothing.

            Your one node has nothing in it, so when the trace function calls toString()
            on it to ouput, it shows you exactly what is in it...nothing.