<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFXMLTree",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@T@CFXMLTreeRef"
  },
  "title" : "CFXMLTree"
}
-->

# CFXMLTree

```
typealias CFXMLTree = CFTree
```

## Overview

A CFXMLTree object is simply a CFTree object whose context data is known to be a CFXMLNode object. CFXMLTree is derived from CFTree—you can pass CFXMLTree objects in all the CFTree functions. As such, a CFXMLTree object can be used to represent an entire XML document; the CFTree object provides the tree structure of the document, while the CFXMLNode objects identify and describe the nodes of the tree. An XML document can be parsed to a CFXMLTree object, and a CFXMLTree object can generate the data for the equivalent XML document. This opaque type is expected to be used in conjunction with CFXMLParser and CFXMLNode objects.

## Topics

### CFXMLTree Miscellaneous Functions

[`CFXMLCreateStringByEscapingEntities(_:_:_:)`](/documentation/CoreFoundation/CFXMLCreateStringByEscapingEntities(_:_:_:))

Given a CFString object containing XML source with unescaped entities, returns a string with specified XML entities escaped.

[`CFXMLCreateStringByUnescapingEntities(_:_:_:)`](/documentation/CoreFoundation/CFXMLCreateStringByUnescapingEntities(_:_:_:))

Given a CFString object containing XML source with escaped entities, returns a string with specified XML entities unescaped.

[`CFXMLTreeCreateFromData`](/documentation/CoreFoundation/CFXMLTreeCreateFromData)

Parses the given XML data and returns the resulting CFXMLTree object.

[`CFXMLTreeCreateFromDataWithError`](/documentation/CoreFoundation/CFXMLTreeCreateFromDataWithError)

Parses the given XML data and returns the resulting CFXMLTree object and any error information.

[`CFXMLTreeCreateWithDataFromURL`](/documentation/CoreFoundation/CFXMLTreeCreateWithDataFromURL)

Creates a new CFXMLTree object by loading the data to be parsed directly from a data source.

[`CFXMLTreeCreateWithNode`](/documentation/CoreFoundation/CFXMLTreeCreateWithNode)

Creates a childless, parentless CFXMLTree object node for a CFXMLNode object.

[`CFXMLTreeCreateXMLData`](/documentation/CoreFoundation/CFXMLTreeCreateXMLData)

Generates an XML document from a CFXMLTree object which is ready to be written to permanent storage.

[`CFXMLTreeGetNode`](/documentation/CoreFoundation/CFXMLTreeGetNode)

Returns the node of a CFXMLTree object.

### Constants

[Error Dictionary Keys](/documentation/CoreFoundation/error-dictionary-keys)

The keys used in an error dictionary returned by some functions to provide more information about XML parse errors.

## See Also

  [XML Programming Topics for Core Foundation](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFXML/CFXML.html#//apple_ref/doc/uid/10000138i)



---

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)