Javascript XMLSerializer区分大小写 [英] Javascript XMLSerializer case sensitive
问题描述
是否是损害大小写的DOM或XMLSerializer?有什么办法绕过它还是我错过了什么?我已经在Chrome和Firefox中尝试过了。
KML文档将被导入Google地球,似乎不接受小写标签。 p>
根据FF4中的测试,以下内容将起作用:
-
使用
document.createElementNS(http://www.opengis.net/kml/2.2,elementName)
而不是document.createElement(elementName)
。 -
使用
elt.appendChild(document.createTextNode文本))
而不是elt.innerHTML = text
。
I'm generating a KML document in Javascript and i'm trying to use XMLSerializer to generate the XML file but it's generating all lower case tags even though i create the tags in capital in the DOM.
Is it the DOM that mangles the capitalization or the XMLSerializer? Is there any way to get around it or am I missing something? I've tried this in both Chrome and Firefox.
The KML document is to be imported into Google Earth and it seems it doesn't accept lower case tags.
Based on testing in FF4, the following will work:
Use
document.createElementNS ("http://www.opengis.net/kml/2.2", elementName)
instead ofdocument.createElement(elementName)
.Use
elt.appendChild (document.createTextNode (text))
instead ofelt.innerHTML = text
.
这篇关于Javascript XMLSerializer区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!