<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/XMLNode/xmlString(options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSXMLNode(im)XMLStringWithOptions:"
  },
  "title" : "xmlString(options:)"
}
-->

# xmlString(options:)

Returns the string representation of the receiver as it would appear in an XML document, with one or more output options specified.

```
func xmlString(options: XMLNode.Options = []) -> String
```

## Parameters

`options`

One or more `enum` constants identifying an output option; bit-OR multiple constants together.  See Constants for a list of valid constants for specifying output options.

## Discussion

The returned string includes the string representations of all children.

---

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)