A representation of a Document Type Definition.
SDK
- macOS 10.4+
Framework
- Foundation
Declaration
class XMLDTD : XMLNode
Overview
An instance of the XMLDTD
class is held as a property of an XMLDocument
instance, accessed through the XMLDocument
method dtd
(and set via set
).
In the data model, an XMLDTD
object is conceptually similar to namespace and attribute nodes: it is not considered to be a child of the XMLDocument
object although it is closely associated with it. It is at the “root” of a shallow tree consisting primarily of nodes representing DTD declarations. Acceptable child nodes are instances of the XMLDTDNode
class as well as XMLNode
objects representing comment nodes and processing-instruction nodes.
You create an NSXMLDTD
object in one of three ways:
By processing an XML document with its own internal (in-line) DTD
By process a standalone (external) DTD
Programmatically
Once an XMLDTD
instance is in place, you can add, remove, and change the XMLDTDNode
objects representing various DTD declarations. When you write the document out as XML, the new or modified internal DTD is included (assuming you set the DTD in the XMLDocument
instance). You may also programmatically create an external DTD and write that out to its own file.