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

# resolveNamespace(forName:)

Returns the namespace node with the prefix matching the given qualified name.

```
func resolveNamespace(forName name: String) -> XMLNode?
```

## Parameters

`name`

A string that is the qualified name for a namespace (a qualified name is prefix plus local name).

## Return Value

An [`XMLNode`](/documentation/Foundation/XMLNode) object of kind [`XMLNode.Kind.namespace`](/documentation/Foundation/XMLNode/Kind-swift.enum/namespace) or `nil` if there is no matching namespace node.

## Discussion

The method looks in the entire namespace chain for the prefix.

---

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)