XML DOM xmlVersion 屬性
定義和用法
xmlVersion 屬性可設置或返回文檔的 XML 版本。
語法:
documentObject.xmlVersion
實例
在所有的例子中,我們將使用 XML 文件 books.xml,以及 JavaScript 函數(shù) loadXMLDoc()。
以下代碼片段可顯示 XML 的編碼方法、standalone 屬性以及文檔的 XML 版本:
xmlDoc=loadXMLDoc("books.xml");
document.write("XML encoding: " + xmlDoc.xmlEncoding);
document.write("<br />");
document.write("XML standalone: " + xmlDoc.xmlStandalone);
document.write("<br />");
document.write("XML version: " + xmlDoc.xmlVersion
);
document.write("<br />");
document.write("Encoding when parsing: " + xmlDoc.inputEncoding);
輸出:
XML encoding: ISO-8859-1 XML standalone: false XML version: 1.0 Encoding when parsing: ISO-8859-1