阅读(2558)
赞(0)
XML DOM xmlEncoding 属性
2015-09-26 18:15:55 更新
XML DOM xmlEncoding 属性
Document 对象
定义和用法
xmlEncoding 属性返回文档的编码。
语法
documentObject.xmlEncoding
实例
下面的代码片段使用 loadXMLDoc() 把 "books.xml" 载入 xmlDoc 中,并显示 XML 编码、standalone 属性和文档的 XML 版本:
实例
xmlDoc=loadXMLDoc("books.xml");
document.write("XML encoding: " + xmlDoc.xmlEncoding);
document.write("
");
document.write("XML standalone: " + xmlDoc.xmlStandalone);
document.write("
");
document.write("XML version: " + xmlDoc.xmlVersion);
document.write("
");
document.write("Encoding when parsing: " + xmlDoc.inputEncoding);
document.write("XML encoding: " + xmlDoc.xmlEncoding);
document.write("
");
document.write("XML standalone: " + xmlDoc.xmlStandalone);
document.write("
");
document.write("XML version: " + xmlDoc.xmlVersion);
document.write("
");
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
XML standalone: false
XML version: 1.0
Encoding when parsing: ISO-8859-1
尝试一下 »
Document 对象