getProperty Method (IXMLDOMSelection)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

getProperty Method (IXMLDOMSelection)

Returns a property.

[Script]

Script Syntax

strValue = objXMLDOMSelection.getProperty(name);

Parameters

name
The string name of the property. This name is case-sensitive.

Example

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var oSelection;
xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   oSelection = xmlDoc.selectNodes("//book");
   alert(oSelection.getProperty("SelectionLanguage"));
}
[Visual Basic]

Visual Basic Syntax

strValue = objXMLDOMSelection.getProperty(name)

Parameters

name
The string name of the property. This name is case-sensitive.

Example

Dim xmlDoc As New Msxml2.DOMDocument50
Dim oSelection As IXMLDOMSelection
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.async = False
xmlDoc.Load "books.xml"
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set oSelection = xmlDoc.selectNodes("//book")
   MsgBox oSelection.getProperty("SelectionLanguage")
End If
[C/C++]

C/C++ Syntax

HRESULT getProperty(BSTR name, VARIANT* value);

Parameters

name [in]
The string name of the property. This name is case-sensitive.
value [out, retval]
The variant return value of the requested property.

C/C++ Return Values

S_OK
The value returned if method successful.
E_INVALIDARG
The value returned if named property does not exist.

Remarks

The getProperty method returns the value for the internal SelectionLanguage property (flag) that was set by calling the setProperty method on the document or the default value.

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

setProperty Method

Applies to: IXMLDOMSelection