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

# next

Returns the next NSXMLNode object in document order.

## Declaration

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

## Discussion

Discussion You use this method to “walk” forward through the tree structure representing an XML document or document section. (Use previous to traverse the tree in the opposite direction.) Document order is the natural order that XML constructs appear in markup text. If you send this message to the last node in the tree, nil is returned. NSXMLNode bypasses namespace and attribute nodes when it traverses a tree in document order.

## See Also

### Navigating the Tree of Nodes

- [rootDocument](foundation/xmlnode/rootdocument.md)
- [parent](foundation/xmlnode/parent.md)
- [child(at:)](foundation/xmlnode/child(at:).md)
- [childCount](foundation/xmlnode/childcount.md)
- [children](foundation/xmlnode/children.md)
- [nextSibling](foundation/xmlnode/nextsibling.md)
- [previous](foundation/xmlnode/previous.md)
- [previousSibling](foundation/xmlnode/previoussibling.md)
- [detach()](foundation/xmlnode/detach().md)
