I may be becoming too ambitious here for e4x, nevertheless!
I have an xml structure

var inputXML:XML =
<books>
<book name="da vinci code" author="dan brown" price="12.22"
quantity="2">
<location city="san francisco" state="california"/>
</book>
<book name="angels and daemons" author="dan brown" price="10.20"
quantity="4">
<location city="miami" state="florida"/>
</book>
<book name="digital fortress" author="dan brown" price="12.22"
quantity="5">
<location city="los angeles" state="california"/>
</book>
</books>;

I want two things from above xml document:
1. list of unique state (attribute) names from above xml. ie., list
containing california,florida. 
I can use for each for this but is there a direct e4x expression to do
this.  Is there a better way?
2. merge the book elements from same state into a single element
adding the prices/quantities but ignoring the name, author, city
attributes and return them as xml-list. ie.,
<book price="24.44" quantity="7">
<location state="california"/>
</book>
<book price="10.20" quantity="4">
<location state="florida"/>
<book>
The only way I can think of doing this is to create a new xml
structure containing the common attributes by looping through the
original xml. Again, is there a better way?

thanks in advance for the help.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to