XML Cache class

This is a class that I wrote quite a while back. It works just like Flash’s XML Class, but if you try and load the same file / URL again, it will use the XML data stored in memory rather than reconnecting to the server.

Example:

[as]
import com.pixelbreaker.utils.XMLCache;

myXML = new XMLCache();
myXML.load( ‘anXMLfile.xml’ ); // will load the file in

myXML2 = new XMLCache();
myXML2.load( ‘anXMLfile.xml’ ); // will use previously loaded data.
[/as]

The idea is simple, the XMLCache class extends XML, and has a static object called xmlCache, whenever an XML file is loaded, it’s stored in the static object with the name exactly representative of the full filename/path passed to the load() method, then whenever it’s called again, the data is pulled from the static object. Easy peasy!

Download it here.

Comments are closed.