<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/nsxmlnode-seturi",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "setURI:"
}
-->

# setURI:

Sets the URI of the receiver.

## Discussion

The receiver must be an [`XMLElement`](/documentation/Foundation/XMLElement) or [`XMLDocument`](/documentation/Foundation/XMLDocument) document, or an attribute (that is, an`NSXMLNode` object of type [`XMLNode.Kind.attribute`](/documentation/Foundation/XMLNode/Kind-swift.enum/attribute)). For documents it is the URI of document origin.

---

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)