A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: XML range

  1. #1
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429

    XML range

    How do I get an XMLList of a range of XML elements. For instance if I wanted myXML[5] through myXML[15]?

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    A simple/easy solution would be something like this:

    PHP Code:
    var xml:XML = <content>
                    <
    news>
                        <
    description>Desc0</description>
                    </
    news>
                    <
    news>
                        <
    description>Desc1</description>
                    </
    news>
                    <
    news>
                        <
    description>Desc2</description>
                    </
    news>
                    <
    news>
                        <
    description>Desc3</description>
                    </
    news>
                    <
    news>
                        <
    description>Desc4</description>
                    </
    news>
                    <
    news>
                        <
    description>Desc5</description>
                    </
    news>
                  </
    content>
                  
    getXmlData(xml13); // get specific nodes
    function getXmlData(xml:XMLstartIndex:NumberendIndex:Number):void
    {
        for (var 
    i:int startIndex<= endIndexi++)
        {
            
    trace(xml.*[i].*.toString());
        }

    But you can always try finding more complex solutions...
    Last edited by fx.barrett; 10-04-2008 at 11:47 AM.



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  3. #3
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    thanks fx,
    I was looking for a slick E4X command rather than a loop. I ended up using a for loop to populate another xml object with groups of nodes and request those groups.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center