dimanche 28 juin 2015

Search informations in a XML database

I've got this xml database :

    <!--
    - Base de données :  'Database_test'
    -->
    <database name="Database_test">
        <!-- Table daytime -->
        <table name="daytime">
            <column name="temps">27 June 2015</column>
            <column name="username">New-York</column>
            <column name="up">6h20</column>
            <column name="down">14h32</column>

        </table>
        <table name="daytime">
            <column name="temps">29 June 2015</column>
            <column name="username">New-York/column>
            <column name="up">8h32</column>
            <column name="down">15h32</column>

        </table>
        <table name="daytime">
            <column name="temps">28 June 2015</column>
            <column name="username">San Francisco</column>
            <column name="up">0h</column>
            <column name="down">12h</column>

        </table>
...
...
...
    </database>

I would like to display in my AIR app (AS3), in a dynamic text field, two variables : up and down but with variables.

Example : if daytime is 28 June 2015 display "up" and "down". or if daytime is 28 June 2015 AND username is "San Francisco" display "up" and "down".

How do I do ?

So far, I've got :

var loader:URLLoader = new URLLoader();
loader.load( new URLRequest( "daytime.xml" ) );
loader.addEventListener(Event.COMPLETE, handleComplete);

But I don't know how to retrieve a specific variable ("up" for example).

Thank you

Aucun commentaire:

Enregistrer un commentaire