XML DOM xmlStandalone Attribute

Document object reference manual

Definition and Usage

The xmlStandalone attribute can be set or returned to determine whether the document is standalone.

Syntax:

documentObject.xmlStandalone

Example

In all examples, we will use the XML file books.xml, as well as the JavaScript function loadXMLDoc().

The following code snippet can display the encoding method, standalone attribute, and XML version of the document:

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 when parsing: " + xmlDoc.inputEncoding);

Output:

XML encoding: ISO-8859-1
XML standalone: false
XML version: 1.0
Encoding when parsing: ISO-8859-1

Document object reference manual