---
title: rootElement()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/xmldocument/rootelement()
---

# rootElement()

Returns the root element of the receiver.

## Declaration

```swift
func rootElement() -> XMLElement?
```

## Return Value

Return Value The root element of the receiver.

## See Also

### Managing the Root Element

- [setRootElement(_:)](foundation/xmldocument/setrootelement(_:).md)
