XML DOM xmlVersion ਗੁਣ

ਵਿਆਖਿਆ ਅਤੇ ਵਰਤੋਂ

xmlVersion ਗੁਣ ਨੂੰ ਸੈਟ ਕਰਨ ਜਾਂ ਦਿਸ਼ਾ-ਨਿਰਦੇਸ਼ ਦਿੰਦਾ ਹੈ ਕਿ ਦਸਤਾਵੇਜ਼ ਦਾ XML ਸੰਸਕਰਣ ਕਿਹੜਾ ਹੈ。

ਵਿਧਾਨ

documentObject.xmlVersion

ਉਦਾਹਰਣ

ਹੇਠ ਦਾ ਕੋਡ "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;
}

亲自试一试