XML DOM inputEncoding 属性
最后更新于:2022-03-26 22:34:04
XML DOM inputEncoding 属性
定义和用法
inputEncoding 属性返回用于文档的编码方式(在解析时)。
语法
documentObject.inputEncoding
实例
下面的代码片段使用 loadXMLDoc() 把 “books.xml” 载入 xmlDoc 中,并显示 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 used when parsing: " + xmlDoc.inputEncoding);
document.write("<br>");
document.write("XML standalone: " + xmlDoc.xmlStandalone);
document.write("<br>");
document.write("XML version: " + xmlDoc.xmlVersion);
document.write("<br>");
document.write("Encoding used when parsing: " + xmlDoc.inputEncoding);
输出:
XML encoding: UTF-8
XML standalone: false
XML version: 1.0
Encoding used when parsing: UTF-8
XML standalone: false
XML version: 1.0
Encoding used when parsing: UTF-8