XML DOM xmlEncodingProperty


Document object

Definition and Usage

The xmlEncoding property returns the document's encoding.

Syntax

documentObject.xmlEncoding


Example

The following code snippet usesloadXMLDoc()put "books.xml"Load into xmlDoc, and display the XML encoding, standalone attribute, and the XML version of the document:"

Example

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);

Output:

XML encoding: UTF-8
XML standalone: false
XML version: 1.0
Encoding used when parsing: UTF-8

Try it Yourself »

Document objectother extensions