Loads an XML document using the supplied string.
boolValue = oXMLDOMDocument.loadXML(bstrXML);
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.
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.5.0");
xmlDoc.async = 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);
}
boolValue = oXMLDOMDocument.loadXML(bstrXML)
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.
The following Microsoft® Visual Basic® example creates a DOMDocument object, and then uses its loadXML method to load the specified XML before displaying it.
Dim xmlDoc As New Msxml2.DOMDocument50
xmlDoc.async = False
xmlDoc.loadXML ("<customer>" & _
"<first_name>Joe</first_name>" & _
"<last_name>Smith</last_name></customer>")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox("You have error " & myErr.reason)
Else
MsgBox xmlDoc.xml
End If
HRESULT loadXML(
BSTR bstrXML,
VARIANT_BOOL * isSuccessful);
documentElement property of the DOMDocument object to Null.isSuccessful parameter is Null.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.
You can use this method to check if the loaded XML document is well-formed. You cannot use it to validate the XML document against a schema.
This member is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
documentElement property | load Method | Persistence and the DOM
Applies to: DOMDocument