NSXMLDTDNode Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.4 and later.
Companion guide
Declared in
NSXMLDTDNode.h

Overview

Instances of the NSXMLDTDNode class represent element, attribute-list, entity, and notation declarations in a Document Type Definition. NSXMLDTDNode objects are the sole children of a NSXMLDTD object (possibly along with comment nodes and processing-instruction nodes). They themselves cannot have any children.

NSXMLDTDNode objects can be of four kinds—element, attribute-list, entity, or notation declaration—and can also be of a subkind, as specified by a NSXMLDTDNodeKind constant. For example, a DTD entity-declaration node could represent an unparsed entity declaration (NSXMLEntityUnparsedKind) rather than a parameter entity declaration (NSXMLEntityParameterKind). You can use a DTD node’s subkind to help determine how to handle the value of the node.

You can create an NSXMLDTDNode object with the initWithXMLString: method, the NSXMLNode class method DTDNodeWithXMLString:, or with the NSXMLNode initializer initWithKind:options: (in the latter method supplying the appropriate NSXMLNodeKind constant).

Setting the object value or string value of an NSXMLDTDNode objects affects different parts of different kinds of declaration. See the related programming topic for more information.

Tasks

Initializing an NSXMLDTDNode Object

Managing the DTD Node Kind

Managing DTD Identifiers

Instance Methods

DTDKind

Returns the receiver’s DTD kind.

- (NSXMLDTDNodeKind)DTDKind
Return Value

The receiver’s DTD kind. See “Constants” for a list of valid NSXMLDTDNodeKind constants.

Discussion

The DTD kind is distinct from a NSXMLDTDNode object’s node kind (returned by the NSXMLNode kind method).

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

initWithXMLString:

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

- (id)initWithXMLString:(NSString *)string
Parameters
string

The DTD declaration.

Return Value

An NSXMLDTDNode object initialized with the DTD declaration in string. Returns nil if initialization did not succeed, as might occur if the passed-in declaration is malformed.

Discussion

The node kind (NSXMLNode) assigned to the returned object—element, attribute, entity, or notation declaration— is based on the full XML string that is parsed. To assign a subkind, use the setDTDKind: method.

You may also use the DTDNodeWithXMLString: or initWithKind: methods to create NSXMLDTDNode instances. However, you cannot use the latter method to create NSXMLDTDNode instances for attribute-list declarations.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

isExternal

Returns a Boolean value that indicates whether the receiver represents a declaration from an external DTD (the system ID is set).

- (BOOL)isExternal
Return Value

YES if receiver represents a declaration from an external DTD (the system ID is set), otherwise NO.

Discussion

This method is valid only for objects representing entities and notations.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

notationName

Returns the name of the notation associated with the receiver.

- (NSString *)notationName
Return Value

The name of the notation associated with the receiver.

Discussion

Notations are applicable to unparsed external entities, processing instructions, and some attribute values.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

publicID

Returns the public identifier associated with the receiver.

- (NSString *)publicID
Return Value

The public identifier associated with the receiver.

Discussion

The public ID is applicable to entities and notations.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

setDTDKind:

Sets the receiver’s DTD kind.

- (void)setDTDKind:(NSXMLDTDNodeKind)kind
Parameters
kind

The receiver’s DTD kind. See “Constants” for a list of valid NSXMLDTDNodeKind constants.

Discussion

The DTD kind is a finer grain of an NSXMLDTDNode object’s node kind (returned by the NSXMLNode kind method).

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSXMLDTDNode.h

setNotationName:

Sets the notation name associated with the receiver.

- (void)setNotationName:(NSString *)notationName
Parameters
notationName

The notation name associated with the receiver.

Discussion

This method is valid for entities only.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

setPublicID:

Sets the public identifier associated with the receiver.

- (void)setPublicID:(NSString *)publicID
Parameters
publicID

The public identifier associated with the receiver. This identifier should be in the default catalog in /etc/xml/catalog or in a path specified by the environment variable XML_CATALOG_FILES.

Discussion

This method is valid for entities and notations only. When the public ID is set the system ID must also be set.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

setSystemID:

Sets the system identifier associated with the receiver.

- (void)setSystemID:(NSString *)systemID
Parameters
systemID

The system identifier associated with the receiver. This value must be a valid URI.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSXMLDTDNode.h

systemID

Returns the system identifier associated with the receiver.

- (NSString *)systemID
Return Value

The system identifier associated with the receiver.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

Constants

NSXMLDTDNodeKind

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 setDTDKind: method.

typedef NSUInteger NSXMLDTDNodeKind;
Availability
  • Available in OS X v10.4 and later.
Declared In
NSXMLDTDNode.h

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 setDTDKind: method.

enum {
   NSXMLEntityGeneralKind = 1,
   NSXMLEntityParsedKind,
   NSXMLEntityUnparsedKind,
   NSXMLEntityParameterKind,
   NSXMLEntityPredefined,
   
   NSXMLAttributeCDATAKind,
   NSXMLAttributeIDKind,
   NSXMLAttributeIDRefKind,
   NSXMLAttributeIDRefsKind,
   NSXMLAttributeEntityKind,
   NSXMLAttributeEntitiesKind,
   NSXMLAttributeNMTokenKind,
   NSXMLAttributeNMTokensKind,
   NSXMLAttributeEnumerationKind,
   NSXMLAttributeNotationKind,
   
   NSXMLElementDeclarationUndefinedKind,
   NSXMLElementDeclarationEmptyKind,
   NSXMLElementDeclarationAnyKind,
   NSXMLElementDeclarationMixedKind,
   NSXMLElementDeclarationElementKind
};
Constants
NSXMLEntityGeneralKind

Identifies a general entity declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLEntityParsedKind

Identifies a parsed entity declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLEntityUnparsedKind

Identifies an unparsed entity declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLEntityParameterKind

Identifies a parameter entity declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLEntityPredefined

Identifies a predefined entity declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeCDATAKind

Identifies an attribute-list declaration with a CDATA (character data) value type.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeIDKind

Identifies an attribute-list declaration with an ID value type (per-document unique element name).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeIDRefKind

Identifies an attribute-list declaration with an IDREF value type (refers to element ID type).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeIDRefsKind

Identifies an attribute-list declaration with an IDREFS value type (refers to multiple elements of ID type).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeEntityKind

Identifies an attribute-list declaration with an ENTITY value type (refers to unparsed entity declared in document).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeEntitiesKind

Identifies an attribute-list declaration with an ENTITIES value type (refers to multiple unparsed entities declared elsewhere in document).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeNMTokenKind

Identifies an attribute-list declaration with a NMTOKEN value type (name token).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeNMTokensKind

Identifies an attribute-list declaration with a NMTOKENS value type (multiple name tokens)

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeEnumerationKind

Identifies an attribute-list declaration with an enumeration value type (list of all possible values).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLAttributeNotationKind

Identifies an attribute-list declaration with a NOTATION value type (name of declared notation).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLElementDeclarationUndefinedKind

Identifies an undefined element declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLElementDeclarationEmptyKind

Identifies a declaration (EMPTY) of an empty element.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLElementDeclarationAnyKind

Identifies an ANY element declaration.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLElementDeclarationMixedKind

Identifies a declaration of an element with mixed content ((#PCDATA | child)).

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

NSXMLElementDeclarationElementKind

Identifies a declaration of an element with child elements.

Available in OS X v10.4 and later.

Declared in NSXMLDTDNode.h.

Declared In
NSXMLDTDNode.h