[prev in list] [next in list] [prev in thread] [next in thread] 

List:       osflash-general
Subject:    [osflash] XMLObject.as class updated
From:       geoff () deconcept ! com (Geoff Stearns)
Date:       2006-05-24 22:38:37
Message-ID: 23F509E6-2C50-4693-848C-29F0A2525AA7 () deconcept ! com
[Download RAW message or body]

just wanted to add this little bit of info:

i still use a really basic xml to object conversion i got from that  
proto.layer51 site way back in the day, converted to an as2 class...  
but an ex-coworker added a really nice bit to it that made working  
with the output a lot easier.

normally when you do xml -> object you will have an array vs. object  
issue - do you use a for loop or a for...in loop? or do you write  
your converter to just make everything an array, so you use array 
[0].array[0].node (which is annoying)

or if you don't use an iterator, you have to check whether your data  
is an array or not, or the content editors can never have less than 2  
or more than 1 content items in a node...

so he made a class that extends the basic object and adds a .length  
to it, so you can treat all your objects as arrays and loop over them  
using for loops, so even if you have one or many nodes, you can  
always just get the .length and treat it as an array.

anyway, code is attached - it looks like your xml parser is much more  
robust, but take a look at xmldatanode.as and see if you like what it  
does... it definitely makes the data handling a little easier once  
you have it converted.

as for the parser, there are some small limitations, such as:
	- it doesn't use a separate array for attributes, so you just use:  
node.node.attribute or node.node._value to access data. this means  
you can't have an attribute and a child node with the same name
	- something else but i forgot what it was!

?


On May 22, 2006, at 1:31 PM, seth hillinger wrote:

>
> nice catch!
>
> On May 22, 2006, at 12:00 PM, osflash-request at osflash.org wrote:
>
>> Date: Mon, 22 May 2006 10:47:58 -0400
>> From: "John Grden" <neoriley at gmail.com>
>> Subject: [osflash] XMLObject.as class updated
>> To: "Open Source Flash Mailing List" <osflash at osflash.org>
>> Message-ID:
>> 	<814c1ea20605220747nd4007ep48d1cb25baca9e6a at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Fixed recursion issue with getObject.  Instead of testing the  
>> first child
>> for children, it should have been testing the childNodes array for  
>> length.
>> Working now.
>>
>> http://mirror1.cvsdude.com/trac/osflash/flasc/browser/trunk/ 
>> DEV_Source/classes/org/opensourceflash/data/XMLObject.as#L172
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20060524/d5b71091/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: com.zip
Type: application/zip
Size: 4379 bytes
Desc: not available
Url : http://osflash.org/pipermail/osflash_osflash.org/attachments/20060524/d5b71091/com.zip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20060524/d5b71091/attachment-0001.htm

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic