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

# processingInstruction(withName:stringValue:)

Returns an `NSXMLNode` object representing a processing instruction with a specified name and value.

```
class func processingInstruction(withName name: String, stringValue: String) -> Any
```

## Parameters

`name`

A string that is the name of the processing instruction.

`stringValue`

A string that is the value of the processing instruction.

## Return Value

An `NSXMLNode` object  of kind [`XMLNode.Kind.processingInstruction`](/documentation/Foundation/XMLNode/Kind-swift.enum/processingInstruction) or `nil` if the object couldn’t be created.

## Discussion

The equivalent XML markup is `<?``name` `value``?>`.

---

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)