Microsoft XML SDK 2.6 - XML Reference

loadXML Method

Loads an XML document using the supplied string.

boolValue = oXMLDOMDocument.loadXML(xmlString)

Parameters

xmlString
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 DOMDocument object's documentElement property to Null if the XML load failed.

Remarks

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

This member is an extension of the W3C DOM.

Example

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

Dim xmlDoc
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.loadXML("<customer><first_name>Joe</first_name><last_name>Smith</last_name></customer>")
MsgBox (xmlDoc.xml)

See Also

Applies To: DOMDocument Object | XML DOM Persistence