http://blog.darkthread.net/blogs/darkthreadtw/archive/2009/04/29/jquery-xmlext-plugin.aspx

jQuery读取xml内容是很简单的操作,但是,要修改就麻烦了。上面给了1个plugin,可以试试:

大家可以下載 jquery.xmlext.js回去玩,或是直接在 Mini jQuery Lab 用以下程式做測試:

$.getScript("jquery.xmlext.js", function() {
            var xd = $.parseXml("<items><center /></items>");
            var x = $(xd);
            x.find("center").appendXml("<bottom />").prependXml("<top />");
            x.find("top,bottom").afterXml("<After />").beforeXml("<Before />");
            alert(x.xml());
            var obj = { Name: "Darkthread", Score: 100 };
            xd = $.toXml(obj, "Person");
            alert($(xd).xml());
            xd = $.toXml(obj, "Person", true);
            alert($(xd).xml());
});
05-11 11:18