Link to home
Start Free TrialLog in
Avatar of error77
error77

asked on

Flex loading (number of results) from xml

Hi all,
I have a flex project that reads an xml file.
I'm currently using loadXML(); where it will load the whole xml...?
Is there a way where I can specify a search where I could get it to load a specified number of nodes or result?

Thanks
Avatar of petiex
petiex
Flag of United States of America image

You can't make a URLLoader filter the results returned from a URLRequest. If you have something server-side generating the URL, you could arrange for some parameters to limit what nodes to send.

But, once you have XML loaded from the server into an XML variable, myXML, you can make a new XML assigned to myTempXML containing any subset of the total nodes in a range from, say firstNode:int to lastNode:int, like this:

myTempXML = <temp/>;
for(var i:int = firstNode; i < lastNode && i < myXML.children().length(); i++){
    myTemp.appendChild(myXML.children()[i];
}
Missed a close-paren there
 myTemp.appendChild(myXML.children()[i]);
Avatar of error77
error77

ASKER

So, would 'i' be the search? For example, if I add a search inputtext and a button and insert something to search for...how would I do that? Thanks for your time by the way!
Avatar of error77

ASKER

In other words. How do I perform a search once XML is loaded. Thanks
ASKER CERTIFIED SOLUTION
Avatar of petiex
petiex
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of error77

ASKER

Fantastic! Thank you!