<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/XMLDTDNode",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSXMLDTDNode"
  },
  "title" : "XMLDTDNode"
}
-->

# XMLDTDNode

A representation of element, attribute-list, entity, and notation declarations in a Document Type Definition.

```
class XMLDTDNode
```

## Overview

[`XMLDTDNode`](/documentation/Foundation/XMLDTDNode) objects are the sole children of a [`XMLDTD`](/documentation/Foundation/XMLDTD) object (possibly along with comment nodes and processing-instruction nodes). They themselves cannot have any children.

[`XMLDTDNode`](/documentation/Foundation/XMLDTDNode) objects can be of four kinds—element, attribute-list, entity, or notation declaration—and can also be of a subkind, as specified by a [`XMLDTDNode.DTDKind`](/documentation/Foundation/XMLDTDNode/DTDKind-swift.enum) constant. For example, a DTD entity-declaration node could represent an unparsed entity declaration ([`XMLDTDNode.DTDKind.unparsed`](/documentation/Foundation/XMLDTDNode/DTDKind-swift.enum/unparsed)) rather than a parameter entity declaration ([`XMLDTDNode.DTDKind.parameter`](/documentation/Foundation/XMLDTDNode/DTDKind-swift.enum/parameter)). You can use a DTD node’s subkind to help determine how to handle the value of the node.

You can create an [`XMLDTDNode`](/documentation/Foundation/XMLDTDNode) object with the [`init(xmlString:)`](/documentation/Foundation/XMLDTDNode/init(xmlString:)-1dyhd) method, the [`XMLNode`](/documentation/Foundation/XMLNode) class method [`dtdNode(withXMLString:)`](/documentation/Foundation/XMLNode/dtdNode(withXMLString:)), or with the [`XMLNode`](/documentation/Foundation/XMLNode) initializer [`init(kind:options:)`](/documentation/Foundation/XMLNode/init(kind:options:)) (in the latter method supplying the appropriate [`XMLNode.Kind`](/documentation/Foundation/XMLNode/Kind-swift.enum) constant).

Setting the object value or string value of an [`XMLDTDNode`](/documentation/Foundation/XMLDTDNode) objects affects different parts of different kinds of declaration. See the related programming topic for more information.

## Topics

### Initializing an NSXMLDTDNode Object

[`-  initWithXMLString:`](/documentation/Foundation/XMLDTDNode/init(xmlString:)-1dyhd)

Returns an `NSXMLDTDNode` object initialized with the DTD declaration in a given string.

### Managing the DTD Node Kind

[`DTDKind`](/documentation/Foundation/XMLDTDNode/dtdKind-swift.property)

Returns the receiver’s DTD kind.

### Managing DTD Identifiers

[`external`](/documentation/Foundation/XMLDTDNode/isExternal)

True if the system id is set. Valid for entities and notations.

[`notationName`](/documentation/Foundation/XMLDTDNode/notationName)

Returns the name of the notation associated with the receiver.

[`publicID`](/documentation/Foundation/XMLDTDNode/publicID)

Returns the public identifier associated with the receiver.

[`systemID`](/documentation/Foundation/XMLDTDNode/systemID)

Returns the system identifier associated with the receiver.

### Constants

[`DTDKind`](/documentation/Foundation/XMLDTDNode/DTDKind-swift.enum)

The type defined for the constants that specify the kind and subkind of DTD declaration represented by an `NSXMLDTDNode` object. You set the DTD-node kind using the <doc:nsxmldtdnode/1806486-setdtdkind> method.

[DTD Node Kind Constants](/documentation/Foundation/dtd_node_kind_constants)

Constants that specify the kind and subkind of DTD declaration represented by an `NSXMLDTDNode` object. You set the DTD-node kind using the <doc:nsxmldtdnode/1806486-setdtdkind> method.

## Relationships

### Conforms To

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

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

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

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

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

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

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

### Inherits From

[`XMLNode`](/documentation/Foundation/XMLNode)

---

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)