1 Reply Latest reply on Feb 26, 2007 7:38 AM by

    EAX Problem with nodename 'id'

    Dzihan Level 1
      I got the following xml object:

      var myXML:XML =
      <data>
      <item>
      <id>123</id>
      </item>
      <item>
      <id>456</id>
      </item>
      </data>

      var xmlList:XMLList = myXML.item.id;
      trace(xmlList.toXMLString()) returns
      <id>123</id>
      <id>456</id>
      fine....

      now i want to get the <item> with id="456".

      var xmlList:XMLList = myXML.item.(id=="456");
      trace(xmlList.toXMLString()) returns
      NADA! NIENTE!

      This is a major problem for me. it seems i cannot get xml nodes with E4X when i'm looking for its children node
      called "id". when i rename my id node to whatever else i get the item!!

      Is this problem known? what can i do?

      Thank you.
        • 1. Re: EAX Problem with nodename 'id'
          This seems to be working fine for me:
          [code]
          private var myXML:XML = <data><item><id>123</id></item><item><id>456</id></item></data>;

          private function onCreationComplete():void
          {
          // Trace out pieces of myXML3
          var xmlList:XMLList = myXML.item.id;
          trace("all ids:" + xmlList.toXMLString());

          var xmlList2:XMLList = myXML.item.(id=="456");
          trace("456: " + xmlList2.toXMLString());

          }

          [flashlog]
          all ids:<id>123</id>
          <id>456</id>
          456: <item>
          <id>456</id>
          </item>

          -b