Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: XMLDatabase - A PureMVC AS3 / AIR Utility  (Read 14953 times)
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« 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.
« Last Edit: September 23, 2012, 03:19:42 by puremvc » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
bernos
Newbie
*
Posts: 2


View Profile Email
« Reply #2 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!
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: January 10, 2009, 09:29:00 »

Thanks for this catch! Can you send me a file I can test this with?

Thanks,
-=Cliff>
Logged
bernos
Newbie
*
Posts: 2


View Profile Email
« Reply #4 on: January 11, 2009, 07:56:35 »

Here you go Cliff. Just a basic xml file which includes the BOM.

Cheers,
Brendan
Logged
Pages: [1]
Print