How do I get an XMLList of a range of XML elements. For instance if I wanted myXML[5] through myXML[15]?
Printable View
How do I get an XMLList of a range of XML elements. For instance if I wanted myXML[5] through myXML[15]?
A simple/easy solution would be something like this:
But you can always try finding more complex solutions...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(xml, 1, 3); // get specific nodes
function getXmlData(xml:XML, startIndex:Number, endIndex:Number):void
{
for (var i:int = startIndex; i <= endIndex; i++)
{
trace(xml.*[i].*.toString());
}
}
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.