2 Replies Latest reply on Jan 7, 2009 9:43 AM by ntsiii

    Repeater and XML problem

    badoumba
      Hi All
      I need to make a menu with 2 levels based on an external xml file. I use for that a repeater but I have some problem to retrieve the data of the second level ( linkname ). I will appreciate some advises :-)


      Here is my xml file:

      <nav>
      <heading title="Search">
      <link>
      <linkname>grtgerger</linkname>
      <linkURL> http://www.myspace.com</linkURL>
      </link>
      </heading>
      <heading title="Social">
      <link>
      <linkname>uioifgoh</linkname>
      <linkURL> http://www.myspace.com</linkURL>
      </link>
      <link>
      <linkname>bvgweyjgyjvg</linkname>
      <linkURL> http://www.myspace.com</linkURL>
      </link>
      <link>
      <linkname>jiohfjildf</linkname>
      <linkURL> http://www.myspace.com</linkURL>
      </link>
      </heading>
      <heading title="News">
      <link>
      <linkname>iouyiodusfdsg</linkname>
      <linkURL> http://www.myspace.com</linkURL>
      </link>
      <link>
      <linkname>uio</linkname>
      <linkURL> http://www.myspace.com</linkURL>
      </link>
      </heading>
      </nav>


      MXML file as attached code.



      Thanks
        • 1. Re: Repeater and XML problem
          ntsiii Level 3
          I do not see anything obviously wrong. You might try:
          text="{linkrep.currentItem.linkname}

          But I recommend that you create a custom component to repeat, rather than nesting them declaratively. Pass the entire currentItem into the the repeated component via a setter function. Then you can debug the inner repeater.

          Tracy
          • 2. Re: Repeater and XML problem
            ntsiii Level 3
            oops, I meant try:
            text="{linkrep.currentItem.linkname.text()}

            Also, I would expect you to be getting compiler warnings saying something to the effect, "XML is not an IEventDispatcher".

            Try:
            text="{XML(linkrep.currentItem).linkname.text()}

            Tracy