length Property (IXMLDOMCharacterData)

MSXML 5.0 SDK

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

length Property (IXMLDOMCharacterData)

Specifies the length, in characters, of the data.

[Script]

Script Syntax

lValue = oXMLDOMCharacterData.length;

Example

The following example creates an IXMLDOMComment object and then assigns the length property to a variable.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var comment;
var lValue;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   comment = xmlDoc.createComment("Hello World!");
   lValue = comment.length;
   alert(lValue);
}
[Visual Basic]

Visual Basic Syntax

lValue = oXMLDOMCharacterData.length

Example

The following example creates an IXMLDOMComment object and then assigns the length property to a variable.

Dim xmlDoc As New Msxml2.DOMDocument50
Dim comment As IXMLDOMComment
Dim lValue As Long
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 comment = xmlDoc.createComment("Hello World!")
   lValue = comment.length
   MsgBox lValue
End If
[C/C++]

C/C++ Syntax

HRESULT get_length(
    long *dataLength);

Parameters

dataLength [out, retval]
The length, in Unicode characters, of the string present in the data property.

C/C++ Return Values

S_OK
The value returned if successful.
E_INVALIDARG
The value returned if the dataLength parameter is Null.

Remarks

Long integer. The property is read-only. It specifies the length, in Unicode characters, of the string present in the data property.

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

data Property

Applies to: IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMText