---
title: namespaces
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/xmlelement/namespaces
---

# namespaces

Sets all of the namespace nodes of the receiver at once, replacing any existing namespace nodes.

## Declaration

```swift
var namespaces: [XMLNode]? { get set }
```

## Parameters

- `namespaces`: An array of doc://com.apple.foundation/documentation/Foundation/XMLNode objects of kind doc://com.apple.foundation/documentation/Foundation/XMLNode/Kind-swift.enum/namespace. If there are namespace nodes with the same prefix, the first attribute with that prefix is used. Send this message with namespaces as nil to remove all namespace nodes.

## See Also

### Handling Namespaces

- [addNamespace(_:)](foundation/xmlelement/addnamespace(_:).md)
- [namespace(forPrefix:)](foundation/xmlelement/namespace(forprefix:).md)
- [removeNamespace(forPrefix:)](foundation/xmlelement/removenamespace(forprefix:).md)
- [resolveNamespace(forName:)](foundation/xmlelement/resolvenamespace(forname:).md)
- [resolvePrefix(forNamespaceURI:)](foundation/xmlelement/resolveprefix(fornamespaceuri:).md)
