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

# CFXMLNode

```
class CFXMLNode
```

## Overview

A CFXMLNode object describes an individual XML construct—like a tag, or a comment, or a string of character data. CFXMLNode is intended to be used with the CFXMLParser and CFXMLTree opaque types.

Each CFXMLNode object contains three main pieces of information—the node’s type, the data string, and a pointer to an additional information data structure. A CFXMLNode object’s type is one of the enumerations described in [`CFXMLNodeTypeCode`](/documentation/CoreFoundation/CFXMLNodeTypeCode). The data string is always a CFString object; the meaning of the string is dependent on the node’s type. The format of the additional data is also dependent on the node’s type; in general, there is a custom structure for each type that requires additional data. See [`CFXMLNodeTypeCode`](/documentation/CoreFoundation/CFXMLNodeTypeCode) for the mapping from a node type to meaning of the data string, and structure of the additional information. Note that these structures are versioned and may change as the parser changes. The current version can always be identified by the [`kCFXMLNodeCurrentVersion`](/documentation/CoreFoundation/kCFXMLNodeCurrentVersion) constant; earlier versions can be identified and used by passing earlier values for the version number (although the older structures would have been removed from the header).

You create a CFXMLNode object using one of the create or copy functions. Use the [`CFXMLNodeGetTypeCode`](/documentation/CoreFoundation/CFXMLNodeGetTypeCode), [`CFXMLNodeGetString`](/documentation/CoreFoundation/CFXMLNodeGetString), and [`CFXMLNodeGetInfoPtr`](/documentation/CoreFoundation/CFXMLNodeGetInfoPtr) functions to get the node type, data string, and additional information respectively. Use the [`CFXMLNodeGetVersion`](/documentation/CoreFoundation/CFXMLNodeGetVersion) function to get a node’s version number.

## Topics

### CFXMLNode Miscellaneous Functions

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

Creates a new CFXMLNode.

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

Creates a copy of a CFXMLNode object.

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

Returns the additional information pointer of a CFXMLNode object.

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

Returns the data string from a CFXMLNode.

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

Returns the XML structure type code for a CFXMLNode object.

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

Returns the type identifier code for the CFXMLNode opaque type.

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

Returns the version number for a CFXMLNode object.

### Data Types

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

Contains information about an element attribute definition.

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

Contains a list of the attributes associated with an element.

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

Contains the source URL and text encoding information for the XML document.

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

Contains the external ID of the DTD.

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

Contains a list of element attributes packaged as CFDictionary key/value pairs.

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

Contains a description of the element type.

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

Contains information describing an XML entity.

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

Contains information describing an XML entity reference.

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

Contains the system and public IDs for an external entity reference.

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

Contains the external ID of the notation.

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

Contains the text of the processing instruction.

### Constants

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

The entity type identification codes that the parser uses to describe XML entities.

[Node Current Version](/documentation/CoreFoundation/1443311-node-current-version)

The version of a CFXMLNode object.

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

The various XML data type identification codes that the parser uses to describe XML structures.

## 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)

## Relationships

### Conforms To

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

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

---

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)