---
title: "elements(forName:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlelement/elements(forname:)"
---

# elements(forName:)

Returns the child element nodes (as NSXMLElement objects) of the receiver that have a specified name.

## Declaration

```swift
func elements(forName name: String) -> [XMLElement]
```

## Parameters

- `name`: A string specifying the name of the child element nodes to find and return. If name is a qualified name, then this method invokes doc://com.apple.foundation/documentation/Foundation/XMLElement/elements(forLocalName:uri:) with the URI parameter set to the URI associated with the prefix. Otherwise comparison is based on string equality of the qualified or non-qualified name.

## Return Value

Return Value An array of of NSXMLElement objects or an empty array if no matching children can be found.

## See Also

### Obtaining Child Elements

- [elements(forLocalName:uri:)](foundation/xmlelement/elements(forlocalname:uri:).md)
