我有这个XML:
<Lists>
<Song>
<SongNumber>0</SongNumber>
<RealSongNumber>5</RealSongNumber>
<SongName>Love you</SongName>
<AlbumNumber>6</AlbumNumber>
</Song>
<Song>
<SongNumber>1</SongNumber>
<RealSongNumber>3</RealSongNumber>
<SongName>Love you2</SongName>
<AlbumNumber>7</AlbumNumber>
</Song>
</Lists>
我需要通过检查孩子的所有值来删除节点<Song></Song>
及其所有子节点,所以我需要问:
如果SongNumber == 0&amp;&amp; RealSongNumber == 5&amp;&amp; SongName ==爱你&amp;&amp; AlbumNumber == 6然后删除我们的父母。
这在AS3中是可能的
我不想按索引删除
提前致谢
答案 0 :(得分:0)
检查出来:
var xml:XML =
<Lists>
<Song>
<SongNumber>0</SongNumber>
<RealSongNumber>5</RealSongNumber>
<SongName>Love you</SongName>
<AlbumNumber>6</AlbumNumber>
</Song>
<Song>
<SongNumber>0</SongNumber>
<RealSongNumber>3</RealSongNumber>
<SongName>Love you2</SongName>
<AlbumNumber>7</AlbumNumber>
</Song>
<Song>
<SongNumber>1</SongNumber>
<RealSongNumber>3</RealSongNumber>
<SongName>Love you2</SongName>
<AlbumNumber>7</AlbumNumber>
</Song>
</Lists>;
delete xml.Song.(elements('SongNumber') == 0 && elements('RealSongNumber') == 5)[0];
trace (xml.toXMLString());
添加您想要的任何其他条件。