String to XML Document

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-12 15:58:33

软件介绍

I created a very basic function which allows you to convert XML in a string type, into an XML Document type, which gives you the benefits of XML with AJAX.

I'll write up a better explanation another time, as well as submit some other useful data conversion functions

<script type="text/javascript">
// Name: createXMLDocument
// Input: String
// Output: XML Document
jQuery.createXMLDocument = function(string)
{
var browserName = navigator.appName;
var doc;
if (browserName == 'Microsoft Internet Explorer')
{
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false'
doc.loadXML(string);
} else {
doc = (new DOMParser()).parseFromString(string, 'text/xml');
}
return doc;
}
</script>

Usage:

<script type="text/javascript">
var text = '<message><from>me</from><to>you</to></message>';
var doc = $.createXMLDocument(text);
</script>

本文地址:https://codercto.com/soft/d/23228.html

jQuery in Action

jQuery in Action

Bear Bibeault、Yehuda Katz / Manning Publications / 2008-2-17 / USD 39.99

A good web development framework anticipates what you need to do and makes those tasks easier and more efficient; jQuery practically reads your mind. Developers of every stripe-hobbyists and professio......一起来看看 《jQuery in Action》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

SHA 加密
SHA 加密

SHA 加密工具