---
title: "init(name:uri:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/xmlelement/init(name:uri:)-1r286"
---

# init(name:uri:)

Returns an NSXMLElement object initialized with the specified name and URI.

## Declaration

```swift
init(name: String, uri URI: String?)
```

## Parameters

- `name`: A string that specifies the qualified name of the element.
- `URI`: A string that specifies the namespace URI associated with the element.

## Return Value

Return Value The initialized NSXMLElement object or nil if initialization did not succeed.

## Discussion

Discussion You can look up the namespace prefix for this element node based on its URI using resolvePrefix(forNamespaceURI:).  This method is the primary initializer for the NSXMLElement class.

## See Also

### Initializing NSXMLElement Objects

- [init(name:)](foundation/xmlelement/init(name:).md)
- [init(name:stringValue:)](foundation/xmlelement/init(name:stringvalue:).md)
- [init(xmlString:)](foundation/xmlelement/init(xmlstring:)-7vkg7.md)
- [init(kind:options:)](foundation/xmlelement/init(kind:options:).md)
