Not sure if this is the "best" way but you can do:

var xml:XML =   <my_xml>
                        <row id="a" />
                        <row id="b" />
                        <row id="c" />
                </my_xml>;

xml.row.(@id == "a").children = xml.row.(@id != "a");
xml.setChildren(xml.row.(@id == "a"));

trace(xml);

// trace
<my_xml>
  <row id="a">
    <row id="b"/>
    <row id="c"/>
  </row>
</my_xml>

Kenneth Kawamoto
http://www.materiaprima.co.uk/

On 11/10/2011 14:53, Paul Andrews wrote:
What's the best way to turn

this:

myXMLNode =
<my_xml>
< row id="a" />
< row id="b" />
< row id="c" />
</my_xml>;

into:

<my_xml>
< row id="a">
< row id="b" />
< row id="c" />
</row>
</my_xml>

Using some E4X?

It's not so much a case of adding b and c as children of a, but of
removing them so I don't end up with:

<my_xml>
< row id="a">
< row id="b" />
< row id="c" />
</row>
< row id="b" />
< row id="c" />
</my_xml>

Paul
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to