私はWindows用のSafariを使用しています。document.prototype.loadXMLが未定義であることを教えてくれます。XMLドキュメントを作成するための他のオプションは何ですか?
1767 次
1 に答える
1
http://www.w3schools.com/Xml/xml_parser.aspから(少し再フォーマット):
次のコードは、XML文字列をロードして解析します。
function loadXML(text) { var xmlDocument = null; // Internet Explorer try { xmlDocument = new ActiveXObject("Microsoft.XMLDOM"); xmlDocument.async = false; xmlDocument.loadXML(text); } // Standards-compliant method. catch (exception) { parser = new DOMParser(); xmlDocument = parser.parseFromString(txt, "text/xml"); } return xmlDocument; }注: Internet Explorerはこの
loadXML()メソッドを使用してXML文字列を解析しますが、他のブラウザーはDOMParserオブジェクトを使用します。
于 2009-07-10T03:09:57.880 に答える