---
title: "insertChildren(_:at:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlelement/insertchildren(_:at:)"
---

# insertChildren(_:at:)

Inserts an array of child nodes at a specified location in the receiver’s list of children.

## Declaration

```swift
func insertChildren(_ children: [XMLNode], at index: Int)
```

## Parameters

- `children`: An array of XML node objects to add as children of the receiver.
- `index`: An integer identifying a position in the receiver’s list of children. An exception is raised if index is out of bounds.

## Discussion

Discussion Insertion of the node increases the indexes of sibling nodes after it by the count of children.

## See Also

### Manipulating Child Elements

- [addChild(_:)](foundation/xmlelement/addchild(_:).md)
- [insertChild(_:at:)](foundation/xmlelement/insertchild(_:at:).md)
- [removeChild(at:)](foundation/xmlelement/removechild(at:).md)
- [replaceChild(at:with:)](foundation/xmlelement/replacechild(at:with:).md)
- [setChildren(_:)](foundation/xmlelement/setchildren(_:).md)
- [normalizeAdjacentTextNodesPreservingCDATA(_:)](foundation/xmlelement/normalizeadjacenttextnodespreservingcdata(_:).md)
