---
title: "resolvePrefix(forNamespaceURI:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlelement/resolveprefix(fornamespaceuri:)"
---

# resolvePrefix(forNamespaceURI:)

Returns the prefix associated with the specified URI.

## Declaration

```swift
func resolvePrefix(forNamespaceURI namespaceURI: String) -> String?
```

## Parameters

- `namespaceURI`: A string identifying the URI associated with the namespace.

## Return Value

Return Value A string that is the matching prefix or nil if it finds no matching prefix.

## Discussion

Discussion The method looks in the entire namespace chain for the URI.

## See Also

### Handling Namespaces

- [addNamespace(_:)](foundation/xmlelement/addnamespace(_:).md)
- [namespaces](foundation/xmlelement/namespaces.md)
- [namespace(forPrefix:)](foundation/xmlelement/namespace(forprefix:).md)
- [removeNamespace(forPrefix:)](foundation/xmlelement/removenamespace(forprefix:).md)
- [resolveNamespace(forName:)](foundation/xmlelement/resolvenamespace(forname:).md)
