Show All

# Count Property (XMLNodes Collection)

A read-only property that returns a count of the number of XML Document Object Model (DOM) node objects contained in the XMLNodes collection.

expression.Count

expression Required. Returns a reference to the XMLNodes collection.

## Security Level

0: Can be accessed without restrictions.

## Remarks

The Count property returns a long integer value.

## Example

In the following example, the Count property is used within a Microsoft JScript for loop to iterate through the collection of XML DOM node objects returned by the GetSelectedNodes method of the View object and display a message box indicating the name of each XML DOM node that is contained in the XMLNodes collection:

    var objXMLNodes;

    objXMLNodes = XDocument.View.GetSelectedNodes();

    for (i=0; i < objXMLNodes.Count; i++)
    {
       XDocument.UI.Alert("XML DOM node  name: " + objXMLNodes(i).nodeName);
    }

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp