- macOS 10.4+
In the data model, an
NSXMLDTD object is conceptually similar to namespace and attribute nodes: it is not considered to be a child of the
NSXMLDocument 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
NSXMLDTDNode class as well as
NSXMLNode 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
NSXMLDTD instance is in place, you can add, remove, and change the
NSXMLDTDNode 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
NSXMLDocument instance). You may also programmatically create an external DTD and write that out to its own file.