开发者

Why is the XML property missing in DOM Document object in browsers other than IE

开发者 https://www.devze.com 2023-02-14 02:20 出处:网络
I think this property is quite useful, http://www.w3schools.com/Dom/prop_document_xml.asp But as you can see, it\'s only available in IE.

I think this property is quite useful,

http://www.w3schools.com/Dom/prop_document_xml.asp

But as you can see, it's only available in IE.

Is there an开发者_如何转开发 equivalent of this property in other browsers?

Thanks in advance.


The xml property is non-standard. The equivalent in other browsers is XMLSerializer.

function serializeXmlNode(xmlNode) {
    if (typeof window.XMLSerializer != "undefined") {
        return (new window.XMLSerializer()).serializeToString(xmlNode);
    } else if (typeof xmlNode.xml != "undefined") {
        return xmlNode.xml;
    }
    return "";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消