length Property (IXMLDOMNodeList)
Indicates the number of items in the collection.
lValue = oXMLDOMNodeList.length;
Example
The following script example creates an IXMLDOMNodeList object and then uses its lengthproperty to support iteration.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); var objNodeList; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode != 0) { var myErr = xmlDoc.parseError; WScript.Echo("You have error " + myErr.reason); } else { objNodeList = xmlDoc.getElementsByTagName("author"); for (var i=0; i<objNodeList.length; i++) { WScript.Echo(objNodeList.item(i).text); } }
lValue = oXMLDOMNodeList.length
HRESULT get_length(
long *listLength);
Parameters
listLength[out, retval]
The number of items in the collection.
C/C++ Return Values
S_OK
The value returned if successful.
E_INVALIDARG
The value returned if the listLength parameter is Null.
Long integer. The property is read-only.
Implemented in:
MSXML 3.0, MSXML 6.0
Show: