Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


loadXML Method

Loads an XML document using the supplied string.

Script Syntax

boolValue = oXMLDOMDocument.loadXML(bstrXML);

Parameters

bstrXML
A string containing the XML string to load into this XML document object. This string can contain an entire XML document or a well-formed fragment.

Return Value

Boolean. Returns True if the XML load succeeded. Returns False and sets the documentElement property of the DOMDocument to Null if the XML load failed.

Example

The following script example creates a DOMDocument object, and then uses its loadXML method to load the specified XML before displaying it.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");  
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
xmlDoc.loadXML("<customer><first_name>Joe</first_name><last_name>Smith</last_name></customer>");
if (xmlDoc.parseError.errorCode <> 0) {    
var myErr = xmlDoc.parseError    
alert("You have error " + myErr.reason); }
else {    alert(xmlDoc.xml); }

Remarks

Calling load or loadXML on an existing document immediately discards the content of the document. The loadXML() method will work only with UTF-16 or UCS-2 encodings.

This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).

 

Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.