---
title: childCount
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/xmlnode/childcount
---

# childCount

Returns the number of child nodes the receiver has.

## Declaration

```swift
var childCount: Int { get }
```

## Discussion

Discussion This receiver should be an NSXMLNode object representing a document, element, or document type declaration. For performance reasons, use this method instead of getting the count from the array returned by children (for example, [[thisNode children] count]).

## See Also

### Navigating the Tree of Nodes

- [rootDocument](foundation/xmlnode/rootdocument.md)
- [parent](foundation/xmlnode/parent.md)
- [child(at:)](foundation/xmlnode/child(at:).md)
- [children](foundation/xmlnode/children.md)
- [next](foundation/xmlnode/next.md)
- [nextSibling](foundation/xmlnode/nextsibling.md)
- [previous](foundation/xmlnode/previous.md)
- [previousSibling](foundation/xmlnode/previoussibling.md)
- [detach()](foundation/xmlnode/detach().md)
