XML deserialization in actionscript -
XML deserialization in actionscript -
i making adobe premiere cc extension in actionscript3, loads xml file file dialog.
and want deserialize xml file custom object, using simplexmldecoder
// loads info input xml file chosen file dialog var xmldoc:xmldocument = new xmldocument(loadfile.data.tostring()); var decoder:simplexmldecoder = new simplexmldecoder(true); //decode input file var data:object = decoder.decodexml(xmldoc); (1)
i have little test xml file:
<?xml version="1.0" encoding="utf-8"?> <p> <data> (first data) <name>video1</name> <duration>250</duration> <fps>24</fps> <files> <cfile> <filename>file 1</filename> <meta>1</meta> </cfile> </files> </data> <data> (second data) <name>video2</name> <duration>250</duration> <fps>24</fps> <files> <cfile> <filename>file 2</filename> <meta>2</meta> </cfile> <cfile> <filename>file 22</filename> <meta>22</meta> </cfile> <cfile> <filename>file 222</filename> <meta>222</meta> </cfile> </files> </data> <data> (third data) <name>video3</name> <duration>250</duration> <fps>24</fps> <files/> </data> </p>
then trying cast decoded object (1) of type objectproxy custom defined object.
i cant find how cast automatically trying manual foreach iteration through elements of decoded object, , putting desired custom defined object.
the problem is: when files tag in xml file contains 1 cfile (like first info in xml) tag converted objectproxy type, when files tag contains more 1 cfile(like sec info element in xml) tag converted array collection type, , @ end can't iterate through tags because of type inconsistency.
any help particular problem or xml serialization in actionscript3 in general???
thanks in advance.
xml actionscript-3 xml-parsing deserialization
Comments
Post a Comment