XML DOM xmlEncoding ਵਿਸ਼ੇਸ਼ਤਾ
ਵਿਵਰਣ ਅਤੇ ਵਰਤੋਂ
xmlEncoding
ਵਿਸ਼ੇਸ਼ਤਾ ਦਸਤਾਵੇਜ਼ ਦੀ ਇੰਕੋਡਿੰਗ ਵਾਪਸ ਦਿੰਦੀ ਹੈ。
ਵਿਧਾਨ
documentObject.xmlEncoding
ਉਦਾਹਰਣ
ਹੇਠਲਾ ਕੋਡ "books.xml" ਨੂੰ xmlDoc ਵਿੱਚ ਲੋਡ ਕਰਦਾ ਹੈ, ਦਸਤਾਵੇਜ਼ ਦੀ XML ਇੰਕੋਡਿੰਗ, standalone ਵਿਸ਼ੇਸ਼ਤਾ ਅਤੇ XML ਸੰਸਕਰਣ ਦਿਸਾਉਂਦਾ ਹੈ:
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "books.xml", true); xhttp.send(); function myFunction(xml) { var xmlDoc = xml.responseXML; document.getElementById("demo").innerHTML = "XML encoding: " + xmlDoc.xmlEncoding + "<br>XML standalone: " + xmlDoc.xmlStandalone + "<br>XML version: " + xmlDoc.xmlVersion + "<br>Encoding used when parsing: " + xmlDoc.inputEncoding; }