1 Reply Latest reply on Dec 21, 2006 6:10 PM by ntsiii

    Parsing image src from xml

    Ezeffy
      First post, Long time reader.

      I have a access to an RSS feed for this and that's all the access i have to the remote site.
      The XML looks something like this off the feed.

      <item>
      <title>photography</title>
      −<link>
      http://main.design.com/photo/main.php?i_itemId=82
      </link>
      −<description>
      <a href=" http://main.design.com/photo/main.php?i_itemId=82"><img border="0" src=" http://main.design/photo/main.php?i_view=core.DownloadItem&amp;i_itemId=83" width="150" height="150"/></a><br/>In album <a href=" http://main.design.com/photo/main.php?i_itemId=80"> photos</a>
      </description>

      ALL I need is the src=" http://main.design/photo....."/> inserted into the data grid.
      i know my data provider is correct because the title feed is inserted correct... and these are the 2 colums im feeding data to. and i see the broken image in the app. im looking for the quickest way to pull this data.

      <mx:columns>
      <mx:DataGridColumn headerText="image" >
      <mx:itemRenderer>
      <mx:Component>
      <mx:VBox>
      <mx:Image id="Image" height="50" width="50" source="description" />
      </mx:VBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      <mx:DataGridColumn headerText="title" dataField="title" width="150" />
      </mx:columns>

      I see right off the bat WHY it's not just displaying the image because of everything else thats in the desciption tag. i guess i just missed something along the way on how to parse through that html and just get what i need.

      thanks
        • 1. Re: Parsing image src from xml
          ntsiii Level 3
          Assuming that html is valid xml, and it apparently is if you are working with it successfully, you would access that value like this:
          description.img.(@src)

          A labelFunction would make it easy to display that string.

          I haven't worked much with in-line renderers so ai am not sure you you would do it in there.

          Tracy