Hi,
I have a load of data loaded from a server as XML which is
essentially a flat list. Nodes in the list have a child node defining a
target and many nodes have the same target.
list
nodetarget1/targetdatablah1/data/node
nodetarget1/targetdatablah2/data/node
]
To: Flashcoders@chattyfig.figleaf.com
Sent: Thursday, November 13, 2008 2:22 PM
Subject: [Flashcoders] XML transformation
Hi,
I have a load of data loaded from a server as XML which is
essentially a flat list. Nodes in the list have a child node defining a
target and many nodes have
Here's a my quick and dirty stab at it, may or may not be what you
looking for:
function transformXML(node:XML):XML
{
if (node.name() == target) {
[EMAIL PROTECTED]id]=node.text();
node.setChildren(node.parent()..*.(name()==data));
}
if (node.name() == node) {
This should work:
private function rearrengeXML(original:XML):XML {
var rearrenged:XML = new XML(tree /);
for each (var node:XML in original.node){
if(rearrenged.target.(@id == node.target).length()){
rearrenged.target.(@id == node.target).appendChild(node.data)
}
Hi,
Cool thanks for the help guys:
Currently looking at XML vs RecordSet / AMF, but I will still need
to parse some XML methinks and the transforms look a lot nicer than my hack!
Glen
___
Flashcoders mailing list
5 matches
Mail list logo