---
title: "child(at:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlnode/child(at:)"
---

# child(at:)

Returns the child node of the receiver at the specified location.

## Declaration

```swift
func child(at index: Int) -> XMLNode?
```

## Parameters

- `index`: An integer specifying a node position in the receiver’s array of children. If index is out of bounds, an exception is raised.

## Return Value

Return Value An NSXMLNode object or nil f the receiver has no children.

## Discussion

Discussion The receiver should be an NSXMLNode object representing a document, element, or document type declaration. The returned node object can represent an element, comment, text, or processing instruction.

## See Also

### Navigating the Tree of Nodes

- [rootDocument](foundation/xmlnode/rootdocument.md)
- [parent](foundation/xmlnode/parent.md)
- [childCount](foundation/xmlnode/childcount.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)
