<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/XMLNode/prefix(forName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSXMLNode(cm)prefixForName:"
  },
  "title" : "prefix(forName:)"
}
-->

# prefix(forName:)

Returns the prefix from the specified qualified name.

```
class func prefix(forName name: String) -> String?
```

## Parameters

`name`

A string that is a qualified name.

## Discussion

For example, if the qualified name is “bst:title”, this method returns “bst”.

## See Also

[`+  predefinedNamespaceForPrefix:`](/documentation/Foundation/XMLNode/predefinedNamespace(forPrefix:))

Returns an `NSXMLNode` object representing one of the predefined namespaces with the specified 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)