Hello here is my situation:
I want to import XML data via a XML Connector, I know how to do this, easy enough.
I want to access that data easilly, not like this:
because as you can see that is just ugly and can get really complicated. So I bind the results from the XMLConnector to a DataHolder. Something like this for example:
If I am importing a simple xml file:
<myXML> <xmlItem name="one" /> <xmlItem name="two" /> <xmlItem name="three" /> </myXML>
I set up the XMLConnector correctly. Then I bind that data with a DataHolder. The data holder schema has 3 elements in it, for example:
Two of the elements from the results are bound to the DataHolder:
first, the array of all the XML elements is bound to xmlArray
second, the ‘name’ attribute of the results is bound to the name in the DataHolder, with the index set to the index property of the Data Holder.
Now, to access the name of the any xml element, I can do this:
[DataHolderInstance].index = 1; trace([DataHolderInstance].name); //outputs: two
now this all works fine and dandy. I can even replace items like this:
[DataHolderInstance].index = 1; [DataHolderInstance].name = "cool";
this piece of code will change both [DataHolderInstance].xmlArray AND [XMLConnectorInstance].results because they are bound in both directions. Therefore the above code would change the results of the XMLConnectorInstance to this:
<myXML> <xmlItem name="one" /> <xmlItem name="cool" /> <xmlItem name="three" /> </myXML>
NOW THE PROBLEM:
I am trying to ADD on to the xml via the DataHolderInstance. for instance If I want something like this:
<myXML> <xmlItem name="one" /> <xmlItem name="two" /> <xmlItem name="three" /> <xmlItem name="four" /> </myXML>
I can’t achieve this. I try the most obvoius thing: since [DataHolderInstance].xmlArray is bound in both directions, I try to simply addItemAt() function, however, this has an unexpected result:
[DataHolderInstance].xmlArray changes correctly but the changes are not reflected on [XMLConnectorInstance].results, they remain the same.
Could some genius out there please help me out with this?
A million "Thank You"s