KeepInTouch: Flash

Quick Update

Posted by: Sammy on: September 10, 2008

A quick update on what’s been happening. Most of the past few weeks have been dedicated to researching literature. This week I have been coding prototype2 and things have been going smoothly till today. It has taken me literally a whole day to figure out a problem to do with parsing XML. Let’s say we have an xml file:

<school>

<parent name="Jack">
    <child>
        <learnt>abc</learnt>
        <learnt>123</learnt>
    </child>
</parent>

<parent name="Jill">
    <child>
        <learnt>abc</learnt>
    </child>
</parent>

</school>

and what we want to do is to find the child who has learnt “abc” and print the parent’s name. So after initialising, the standard E4X code to filter the xml would be:

xml.parent.(child.learnt.text()=="abc").@name;

But this only returns a result of “Jill” but not “Jack” when Jack is valid. It turns out that to search through multiple nodes on the same level you have to tell it to search through the ‘length’ of the level:

xml.parent.(child.learnt.(text()=="abc").length()).@name;

This applies if you have multiple child under the parent (.length() would correspond to child. and not learnt. as it is now) and so on.

 

Anyway, things are progressing smoothly again and as it is now it gets it’s users and pictures from the xml data and am up to the initial stages of the contact page. I have retrieved and parsed the contacts relevant to the logged in user but I have noticed that not all users have a url to their pictures and this will be a problem when loading the contacts. I will have to manually add it to the xml file and considering the size of the xml file, this might take some time. Practice talk is next week so I should starting writing that up.

Leave a Reply

 

September 2008
M T W T F S S
« Aug   Oct »
1234567
891011121314
15161718192021
22232425262728
2930  

Blog Stats

  • 252 hits