You are here: Reference > JavaScript > client-side > xml handling > properties > xmlStandalone (XMLDocument)

xmlStandalone property (XMLDocument)

Browser support:
Returns whether the XMLDocument is standalone.

Syntax:

object.xmlStandalone;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Boolean that specifies the standalone state of the XMLDocument.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the xmlStandalone property:
Code
ajax.js
news.xml
<head>
    <script type="text/javascript" src="ajax.js"></script>
    
    <script type="text/javascript">
        var httpRequest = null;
        
        function SendRequest () {
            if (!httpRequest) {
                httpRequest = CreateHTTPRequestObject ();   // defined in ajax.js
            }
            if (httpRequest) {          
                    // The requested file must be in the same domain that the page is served from.
                var url = "news.xml";
                httpRequest.open ("GET", url, true);    // async
                httpRequest.onreadystatechange = OnStateChange;
                httpRequest.send (null);
            }
        }

        function OnStateChange () {
            if (httpRequest.readyState == 0 || httpRequest.readyState == 4) {
                if (IsRequestSuccessful (httpRequest)) {    // defined in ajax.js
                    DisplayInfo ();
                }
                else {
                    alert ("Operation failed.");
                }
            }
        }

        function DisplayInfo () {
            var xmlDoc = ParseHTTPResponse (httpRequest);   // defined in ajax.js
            if (!xmlDoc)
                return;

            var message = "";
            message += "Encoding: " + xmlDoc.xmlEncoding + "\n";
            message += "Standalone: " + xmlDoc.xmlStandalone + "\n";
            message += "Version: " + xmlDoc.xmlVersion + "\n";
            alert (message);
        }
    </script>
</head>
<body>
    <button onclick="SendRequest ()">Get information from news.xml</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

User Contributed Comments

Post Content

Post Content