1

如何使用 Adob​​e Air 删除 XML 条目?

这就是我的 XML 的样子:

<?xml version="1.0" encoding="utf-8"?>
    <ENTRY "IMG_ID="01042012"/>
    <ENTRY "IMG_ID="03052012"/>
    <ENTRY "IMG_ID="09052012"/>

这是我加载 XML 的代码:

var xmlGallery:XML

    function readGalleryXml(e:Event = null):void
    {
        var fileGallery:File = File.applicationStorageDirectory.resolvePath("gallery.xml");
        if (fileGallery.exists)
        {
            var streamGallery:FileStream = new FileStream();
            try
            {
                streamGallery.openAsync(fileGallery,flash.filesystem.FileMode.READ);
                xmlGallery = new XML(streamGallery.readUTFBytes(streamGallery.bytesAvailable));
            }
            finally
            {
                streamGallery.close();
            }
        }
    }

谢谢。乌里

4

1 回答 1

1

您可以按照此处所述滚动您自己的删除子功能:

 public static function deleteNode(node:XML):void
 {
     if (node != null && node.parent() != null)
     {
         delete node.parent().children()[node.childIndex()];
     }
}
于 2012-05-20T02:44:45.073 回答