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

# parent

Returns the parent node of the receiver.

## Declaration

```swift
@NSCopying var parent: XMLNode? { get }
```

## Discussion

Discussion Document nodes and standalone nodes (that is, the root of a detached branch of a tree) have no parent, and sending this message to them returns nil. A one-to-one relationship does not always exists between a parent and its children; although a namespace or attribute node cannot be a child, it still has a parent element.

## See Also

### Navigating the Tree of Nodes

- [rootDocument](foundation/xmlnode/rootdocument.md)
- [child(at:)](foundation/xmlnode/child(at:).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)
