2 Replies Latest reply on Feb 6, 2011 11:52 PM by igor1986

    XML parent() method not work as expected

    igor1986

      Hello! I have simple xml obj with such structure

       


      var tmpIncomeTrXML:XML =

       

      <tg>
         <transaction ID="455T1656421713052010" DESCRIPTION="life" />
         <transaction ID="904T1448508591262010" DESCRIPTION="fruits" />
         <transaction ID="3T1111581091362010" DESCRIPTION="food">
             <transaction ID="693T111282181362010" DESCRIPTION="bread"/>
             <transaction ID="322T111287961362010" DESCRIPTION="apples"/>
             <transaction ID="332T125144312522011" DESCRIPTION="milk" >
                   <transaction ID="797T125155781522011" DESCRIPTION="meat"/>
                   <transaction ID="860T125157390522011" DESCRIPTION="oranges"/>
             </transaction>
         </transaction>
         <transaction ID="294T1511330422011" DESCRIPTION="Fuel" />
      </tg>

       


      Then i need to get parent node of some nested node:

       


      trace(tmpIncomeTrXML..transaction.(@DESCRIPTION=="milk").parent());

       


      In output we see

       


      <tg>
        <transaction ID="693T111282181362010" DESCRIPTION="bread"/>
        <transaction ID="322T111287961362010" DESCRIPTION="apples"/>
        <transaction ID="332T125144312522011" DESCRIPTION="milk" >
               <transaction ID="797T125155781522011" DESCRIPTION="meat"/>
               <transaction ID="860T125157390522011" DESCRIPTION="oranges"/>
         </transaction>
      </tg>

       


      But should it be like this:

       


      <transaction ID="3T1111581091362010" DESCRIPTION="food">
            <transaction ID="693T111282181362010" DESCRIPTION="bread"/>
            <transaction ID="322T111287961362010" DESCRIPTION="apples"/>
            <transaction ID="332T125144312522011" DESCRIPTION="milk" >
                 <transaction ID="797T125155781522011" DESCRIPTION="meat"/>
                 <transaction ID="860T125157390522011" DESCRIPTION="oranges"/>
            </transaction>
      </transaction>

       


      Thank you for any help.