Reputation: 67
I found where the problem occurs, but can't understand the reason and way to correct it.
It works in other frame but with little difference: XML it can't delete after some successful deletes:
<work name="New Work Title 14" img="" logo="" link="" image=""></work>
<work name="New Work Title 15" img="" logo="" link="" image=""></work>
.... etc
XML from frame where the same script works:
<person name="New Object Name 8" poz="" mail="" thumb="" img=""/>
The first trace and third give same values after some successful deletes:
function deleteWork(){
trace(siteDataXML[Work_Node].length()) // freezes on ~10
trace(delete siteDataXML[Work_Node][Work_List.selectedIndex]) //always true
trace(siteDataXML[Work_Node].length()) // freezes on ~10
Work_DP.removeItemAt(Work_List.selectedIndex); //
trace("dp ", Work_DP.length) // decreases as it should
debug("Data Deleted. Autosaving...")
Work_Save();
}
Can be the </work>
be the reason, but in other test file it deletes similar xml node.
If I generate xml without </work>
the delete works as it should.
Any Idea? Hope someone can help.
I think I found the reason.
Flash automatically converts
<work name="New Work Title 14" img="" logo="" link="" image=""></work>
to
<work name="New Work Title 14" img="" logo="" link="" image="" />
after this delete doesn't delete node.
I added <![CDATA[]]>
:
<work name="New Work Title 14" img="" logo="" link="" image=""><![CDATA[]]></work>
But why does this happen?
Upvotes: 0
Views: 69
Reputation: 67
Cause of deadlines I couldn't spend much time on it, and bypassed it by remaking the admin panel page script. Found better ways.
I'm trying to simulate that problem on new clean file but can't...
I think that the solution should be to add <![CDATA[]]>
to xmls to protect from conversation. If all XML-s are left in same format, the delete should work well.
P.S. the the cdata is converted to escaped format when text is converted to xml and saved. The way to keep htmlText format with cdata is:
someXML.someNode[i] = new XML('<test aaa="aaaa" bbb="bbbb" ccc="cccc"><![CDATA['+someTextField.htmlText+']]></test>')
not so:
someXML.someNode[i] = '<![CDATA['+someString+']]>'
Upvotes: 1