<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/XMLElement/elements(forLocalName:uri:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSXMLElement(im)elementsForLocalName:URI:"
  },
  "title" : "elements(forLocalName:uri:)"
}
-->

# elements(forLocalName:uri:)

Returns the child element nodes (as `NSXMLElement` objects) of the receiver that are matched with the specified local name and URI.

```
func elements(forLocalName localName: String, uri URI: String?) -> [XMLElement]
```

## Parameters

`localName`

A string specifying a local name of an element.

`URI`

A string specifying a URI associated with an element.

## Return Value

An array of `NSXMLElement` objects or an empty array if no matching children could be found.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)