# Quick Question

**URL:** <https://forum.kirupa.com/t/quick-question/257137>\
**Category:** Uncategorized\
**Created:** [April 10, 2008, 3:26pm UTC](https://forum.kirupa.com/t/quick-question/257137 "2008-04-10T15:26:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellils](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@ellils](https://forum.kirupa.com/u/ellils)\
**Post date:** [April 10, 2008, 3:26pm UTC](https://forum.kirupa.com/t/quick-question/257137/1 "2008-04-10T15:26:10Z")

</div>

Hi guys,

I am experimenting with Flash’s Xpath feature which permits easy parsing of XML data.

My XML file is structured this way

```auto

<portfolio>
    <chapter ID="ch1" name="chapter one">
        <image ID="i1" name="image one" url="images/image1.jpg" thumbnail="thumbnail1" caption="this is my first image"/>
        <image ID="i2" name="image two" url="images/image2.jpg" thumbnail="thumbnail2" caption="this is my second image"/>
        <image ID="i3" name="image three" url="images/image3.jpg" thumbnail="thumbnail3" caption="this is my third image"/>
   </chapter>
</portfolio>

```

How should I go about parsing specifically my Thumbnail Images.  
Each image asset has 2 corresponding images in the filesystem. A “Thumbnail” and the original high resolution image. The thumbnail images exist in /images\_tn folder while the original images exist in /images folder. So for example, I will have images/image1.jpg high resolution file in the images folder and on the other hand, I will have a corresponding images\_tn/image1.jpg thumbnail representing the same image.

I am trying to create a Thumbnail scroller and I would like to specifically parse the Thumbnail Images into the scroller from XML…

How should I go about doing this? I have fiddled with

```auto

import mx.xpath.*; 

var chapterData:Array = new Array();
var imageData:Array = new Array();

var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(){
    var allChapters:Array = XPathAPI.selectNodeList(this.firstChild, "/portfolio/chapter")
    var totalChapters = allChapters.length;
    // trace("allChapters :" + allChapters)
    for(var i = 0; i<totalChapters; i++){
        
        var thisChapter:XMLNode = allChapters*;
        chapterData.push ( new ChapterInfo(thisChapter) );
        var chapterID = thisChapter.attributes.ID;
        
        var imagesInThisChapter:Array = XPathAPI.selectNodeList(thisChapter, "/chapter/image[@thumbnail]");
        var totalImages = imagesInThisChapter.length;
        trace("Images in This Chapter : "+imagesInThisChapter);
        
        for(var j = 0; j<totalImages; j++){
            var thisImage = new ImageInfo(imagesInThisChapter[j]);
            
            thisImage.chapterID = chapterID;
            imageData.push(thisImage);
            
        }
    }
}

xmlData.load("images.xml");

```

But all that got me to is parsing in the original high resolution images… I have no idea how to access the thumbnail images…

Please help…

Thanks a lot  
Ellils

Thank you for your input.
