---
title: "attribute(forLocalName:uri:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlelement/attribute(forlocalname:uri:)"
---

# attribute(forLocalName:uri:)

Returns the attribute node of the receiver that is identified by a local name and URI.

## Declaration

```swift
func attribute(forLocalName localName: String, uri URI: String?) -> XMLNode?
```

## Parameters

- `localName`: A string specifying the local name of an attribute.
- `URI`: A sting identifying the URI associated with an attribute.

## Return Value

Return Value An XML node object representing a matching attribute or nil if no such node was found.

## See Also

### Handling Attributes

- [addAttribute(_:)](foundation/xmlelement/addattribute(_:).md)
- [attribute(forName:)](foundation/xmlelement/attribute(forname:).md)
- [attributes](foundation/xmlelement/attributes.md)
- [removeAttribute(forName:)](foundation/xmlelement/removeattribute(forname:).md)
- [setAttributesWith(_:)](foundation/xmlelement/setattributeswith(_:).md)
- [setAttributesAs(_:)](foundation/xmlelement/setattributesas(_:).md)
