2014-06-11 54 views
0

我有這樣的XML:Actionscript3 XML如何通過搜索多個孩子來刪除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 & & RealSongNumber == 5 & & SongName ==愛你& & AlbumNumber == 6然後刪除我們的父母。

這可能在AS3

我不想被索引

由於事先刪除

回答

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()); 

添加你想要的任何其他條件。