<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFXMLParserOptions",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@E@CFXMLParserOptions"
  },
  "title" : "CFXMLParserOptions"
}
-->

# CFXMLParserOptions

Options you can use to control the parser’s treatment of an XML document.

```
struct CFXMLParserOptions
```

## Overview

These are the various options you use to configure the parser. An option flag of 0 ([`kCFXMLParserNoOptions`](/documentation/CoreFoundation/CFXMLParserOptions/kCFXMLParserNoOptions)) leaves the XML as “intact” as possible (reports all structures; performs no replacements). Hence, to make the parser do the most work, returning only the pure element tree, set the option flag to [`allOptions`](/documentation/CoreFoundation/CFXMLParserOptions/allOptions).

## Topics

### Constants

[`kCFXMLParserValidateDocument`](/documentation/CoreFoundation/CFXMLParserOptions/validateDocument)

Validates the document against its grammar from the DTD, reporting any errors. Currently not supported.

[`kCFXMLParserSkipMetaData`](/documentation/CoreFoundation/CFXMLParserOptions/skipMetaData)

Silently skip over metadata constructs (the DTD and comments).

[`kCFXMLParserReplacePhysicalEntities`](/documentation/CoreFoundation/CFXMLParserOptions/replacePhysicalEntities)

Replaces declared entities like `&lt`;. Note that other than the 5 predefined entities (`lt`, `gt`, `quot`, `amp`, `apos`), these must be defined in the DTD. Currently not supported.

[`kCFXMLParserSkipWhitespace`](/documentation/CoreFoundation/CFXMLParserOptions/skipWhitespace)

[`kCFXMLParserResolveExternalEntities`](/documentation/CoreFoundation/CFXMLParserOptions/resolveExternalEntities)

Resolves all external entities.

[`kCFXMLParserAddImpliedAttributes`](/documentation/CoreFoundation/CFXMLParserOptions/addImpliedAttributes)

Where the DTD specifies implied attribute-value pairs for a particular element, add those pairs to any occurrences of the element in the element tree. Currently not supported.

[`kCFXMLParserAllOptions`](/documentation/CoreFoundation/CFXMLParserOptions/allOptions)

Makes the parser do the most work, returning only the pure elementtree.

[`kCFXMLParserNoOptions`](/documentation/CoreFoundation/CFXMLParserOptions/kCFXMLParserNoOptions)

Leaves the XML as “intact” as possible (reports all structures; performs no replacements).

## Relationships

### Conforms To

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`ExpressibleByArrayLiteral`](/documentation/Swift/ExpressibleByArrayLiteral)

[`OptionSet`](/documentation/Swift/OptionSet)

[`SetAlgebra`](/documentation/Swift/SetAlgebra)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

---

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)