PureMVC Architects Lounge

PureMVC Manifold => Demos and Utils => Topic started by: puremvc on February 17, 2008, 09:25:16



Title: XMLDatabase - A PureMVC AS3 / AIR Utility
Post by: puremvc on February 17, 2008, 09:25:16
This utility provides the ability for PureMVC-based AIR applications to easily create and persist and work with XML databases.

The utility has historically been located here: http://trac.puremvc.org/Utility_AS3_AIR_XMLDatabase
The project has been moved here: https://github.com/PureMVC/puremvc-as3-util-air-xmldatabase/wiki

The author is Cliff Hall.


Title: Re: XMLDatabase - A PureMVC AS3 / AIR Utility
Post by: puremvc on December 02, 2008, 07:50:30
1.2 of this utility has been released. There is no need to upgrade existing Standard Version apps, as the only change was to add support for MultiCore.

-=Cliff>


Title: Re: XMLDatabase - A PureMVC AS3 / AIR Utility
Post by: bernos on January 08, 2009, 09:47:08
Great utility Cliff, thanks! One problem I've come across is when attempting to load xml from a utf-8 encoded file which includes the 3-byte BOM up front. The xml constructor baulks at trying to parse the string read from the file stream as it ignores the BOM. I got around this by overriding the XMLDataProxy.read() method as follows:
:
override protected function read():XML
{
// Read the database file into an XML object and return it
var dbStream:FileStream;
dbStream = new FileStream();
dbStream.open(dbFile, FileMode.READ);

// Accomodate byte order marker
if (((dbStream.readUnsignedByte() << 16) | (dbStream.readUnsignedByte() << 8) | dbStream.readUnsignedByte()) ^ 0xEFBBBF) {
dbStream.position = 0;
}

var dbXML:XML = XML(dbStream.readUTFBytes(dbStream.bytesAvailable));
dbStream.close();
return dbXML;
}

Cheers!


Title: Re: XMLDatabase - A PureMVC AS3 / AIR Utility
Post by: puremvc on January 10, 2009, 09:29:00
Thanks for this catch! Can you send me a file I can test this with?

Thanks,
-=Cliff>


Title: Re: XMLDatabase - A PureMVC AS3 / AIR Utility
Post by: bernos on January 11, 2009, 07:56:35
Here you go Cliff. Just a basic xml file which includes the BOM.

Cheers,
Brendan