如何使用jquery创建xml文件 [英] How to create xml file with jquery

查看:106
本文介绍了如何使用jquery创建xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法只使用jquery / javascript创建xml文件?

Is there a way to create xml file only with jquery/javascript ?

推荐答案

使用 jQuery.parseXML 来解析一个简单的容器字符串:

Use jQuery.parseXML to parse a trivial container string:

var xml = '<?xml version="1.0"?><root/>';
var doc = jQuery.parseXML(xml);

然后,您可以使用普通的jQuery DOM操作将节点附加到该XML文档。一旦您需要序列化最终文档,您可以使用此问题<的答案/ a>。

Then you can use normal jQuery DOM manipulation to append nodes to that XML document. Once you need to serialize the final document, you can use the answers to this question.

这篇关于如何使用jquery创建xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆