CFXMLNode Reference
| Derived from | |
| Framework | CoreFoundation/CoreFoundation.h |
| Companion guide | |
| Declared in | CFXMLNode.h |
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 Node Type Code. 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 Node Type Code 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 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, CFXMLNodeGetString, and CFXMLNodeGetInfoPtr functions to get the node type, data string, and additional information respectively. Use the CFXMLNodeGetVersion function to get a node’s version number.
Data Types
CFXMLAttributeDeclarationInfo
Contains information about an element attribute definition.
struct CFXMLAttributeDeclarationInfo {
CFStringRef attributeName;
CFStringRef typeString;
CFStringRef defaultString;
};
typedef struct CFXMLAttributeDeclarationInfo CFXMLAttributeDeclarationInfo;
Fields
attributeNameThe name of the attribute.
typeStringDescribes the declaration of a single attribute.
defaultStringThe attribute's default value.
Discussion
This structure is part of the definition of the CFXMLAttributeListDeclarationInfo structure.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLAttributeListDeclarationInfo
Contains a list of the attributes associated with an element.
struct CFXMLAttributeListDeclarationInfo {
CFIndex numberOfAttributes;
CFXMLAttributeDeclarationInfo *attributes;
};
typedef struct CFXMLAttributeListDeclarationInfo CFXMLAttributeListDeclarationInfo;
Fields
numberOfAttributesThe number of attributes in the array.
attributesA C array of attributes.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters an attribute declaration in the DTD. Use the CFXMLNodeGetInfoPtr function to obtain the pointer to this structure.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLDocumentInfo
Contains the source URL and text encoding information for the XML document.
struct CFXMLDocumentInfo {
CFURLRef sourceURL;
CFStringEncoding encoding;
};
typedef struct CFXMLDocumentInfo CFXMLDocumentInfo;
Fields
sourceURLThe source URL of the XML document.
encodingThe text encoding of the XML document.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters the XML declaration. Use the CFXMLNodeGetInfoPtr function to obtain the pointer.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLDocumentTypeInfo
Contains the external ID of the DTD.
struct CFXMLDocumentTypeInfo {
CFXMLExternalID externalID;
};
typedef struct CFXMLDocumentTypeInfo CFXMLDocumentTypeInfo;
Fields
externalIDThe external ID of the DTD.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters the beginning of the DTD. Use the CFXMLNodeGetInfoPtr function to obtain a pointer to this structure.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLElementInfo
Contains a list of element attributes packaged as CFDictionary key/value pairs.
struct CFXMLElementInfo {
CFDictionaryRef attributes;
CFArrayRef attributeOrder;
Boolean isEmpty;
};
typedef struct CFXMLElementInfo CFXMLElementInfo;
Fields
attributesThe dictionary of attribute values.
attributeOrderAn array specifying the order in which the attributes appeared in the XML document.
isEmptyA flag indicating whether the element was expressed in closed form.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters an element containing attributes. Use the CFXMLNodeGetInfoPtr function to obtain the pointer.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLElementTypeDeclarationInfo
Contains a description of the element type.
struct CFXMLElementTypeDeclarationInfo {
CFStringRef contentDescription;
};
typedef struct CFXMLElementTypeDeclarationInfo CFXMLElementTypeDeclarationInfo;
Fields
contentDescriptionA textual description of the element type.
Discussion
A pointer to this structure is included in the CFXMLNode passed to your application when the parser encounters and element type declaration. Use the CFXMLNodeGetInfoPtr function to obtain a pointer to this structure.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLEntityInfo
Contains information describing an XML entity.
struct CFXMLEntityInfo {
CFXMLEntityTypeCode entityType;
CFStringRef replacementText;
CFXMLExternalID entityID;
CFStringRef notationName;
};
typedef struct CFXMLEntityInfo CFXMLEntityInfo;
Fields
entityTypeThe entity type code.
replacementTextNULLifentityTypeis external or unparsed, otherwise the text that the entity should be replaced with.entityIDentityID.systemIDwill beNULLifentityTypeis internal.notationNameNULLifentityTypeis parsed.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters an entity declaration. Use the CFXMLNodeGetInfoPtr function to obtain a pointer to this structure.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLEntityReferenceInfo
Contains information describing an XML entity reference.
struct CFXMLEntityReferenceInfo {
CFXMLEntityTypeCode entityType;
};
typedef struct CFXMLEntityReferenceInfo CFXMLEntityReferenceInfo;
Fields
entityTypeThe entity type code.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters an entity reference. Use the CFXMLNodeGetInfoPtr function to obtain the pointer.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLExternalID
Contains the system and public IDs for an external entity reference.
struct CFXMLExternalID {
CFURLRef systemID;
CFStringRef publicID;
};
typedef struct CFXMLExternalID CFXMLExternalID;
Fields
systemIDThe systemID URL.
publicIDThe publicID string.
Discussion
This structure is part of the definition of the CFXMLDocumentTypeInfo, CFXMLNotationInfo, and CFXMLEntityInfo structures.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLNodeRef
A reference to a CFXMLNode object.
typedef const struct __CFXMLNode *CFXMLNodeRef;
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLNotationInfo
Contains the external ID of the notation.
struct CFXMLNotationInfo {
CFXMLExternalID externalID;
};
typedef struct CFXMLNotationInfo CFXMLNotationInfo;
Fields
externalIDThe external ID of the notation.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters a notation element. Use the CFXMLNodeGetInfoPtr function to obtain a pointer to this structure.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hCFXMLProcessingInstructionInfo
Contains the text of the processing instruction.
struct CFXMLProcessingInstructionInfo {
CFStringRef dataString;
};
typedef struct CFXMLProcessingInstructionInfo CFXMLProcessingInstructionInfo;
Fields
dataStringThe text of the processing instruction.
Discussion
A pointer to this structure is included in the CFXMLNode object passed to your application when the parser encounters a processing instruction. Use the CFXMLNodeGetInfoPtr function to obtain the pointer.
Availability
- Available in OS X v10.0 and later.
Declared In
CFXMLNode.hConstants
Entity Type Code
The entity type identification codes that the parser uses to describe XML entities.
enum CFXMLEntityTypeCode {
kCFXMLEntityTypeParameter = 0,
kCFXMLEntityTypeParsedInternal = 1,
kCFXMLEntityTypeParsedExternal = 2,
kCFXMLEntityTypeUnparsed = 3,
kCFXMLEntityTypeCharacter = 4
};
typedef enum CFXMLEntityTypeCode CFXMLEntityTypeCode;
Constants
kCFXMLEntityTypeParameterImplies a parsed, internal entity.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLEntityTypeParsedInternalIndicates a parsed, internal entity.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLEntityTypeParsedExternalIndicates a parsed, external entity.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLEntityTypeUnparsedIndicates an unparsed entity.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLEntityTypeCharacterIndicates a character entity type.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.
Discussion
These codes are used with the CFXMLEntityInfo and CFXMLEntityReferenceInfo structures.
Node Current Version
The version of a CFXMLNode object.
enum {
kCFXMLNodeCurrentVersion = 1
};
Constants
kCFXMLNodeCurrentVersionThe current version of CFXMLNode objects.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.
Node Type Code
The various XML data type identification codes that the parser uses to describe XML structures.
enum CFXMLNodeTypeCode {
kCFXMLNodeTypeDocument = 1,
kCFXMLNodeTypeElement = 2,
kCFXMLNodeTypeAttribute = 3,
kCFXMLNodeTypeProcessingInstruction = 4,
kCFXMLNodeTypeComment = 5,
kCFXMLNodeTypeText = 6,
kCFXMLNodeTypeCDATASection = 7,
kCFXMLNodeTypeDocumentFragment = 8,
kCFXMLNodeTypeEntity = 9,
kCFXMLNodeTypeEntityReference = 10,
kCFXMLNodeTypeDocumentType = 11,
kCFXMLNodeTypeWhitespace = 12,
kCFXMLNodeTypeNotation = 13,
kCFXMLNodeTypeElementTypeDeclaration = 14,
kCFXMLNodeTypeAttributeListDeclaration = 15
};
typedef enum CFXMLNodeTypeCode CFXMLNodeTypeCode;
Constants
kCFXMLNodeTypeDocumentIndicates a document where the data string is
NULLand the additional information is a pointer to aCFXMLDocumentInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeElementIndicates an element where the data string is the name of the tag and the additional information is a pointer to a
CFXMLElementInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeAttributeCurrently not used.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeProcessingInstructionIndicates a processing instruction where the data string is the name of the target and the additional information is a pointer to a
CFXMLProcessingInstructionInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeCommentIndicates a comment section where the data string is the text of the comment and the additional information is
NULL.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeTextIndicates a text section where the data string is the text’s contents and the additional information is
NULL.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeCDATASectionIndicates a CDATA section where the data string is the text of the CDATA and the additional information is
NULL.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeDocumentFragmentCurrently not used.
Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeEntityIndicates an entity where the data string is the name of the entity and the additional information is a pointer to a
CFXMLEntityInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeEntityReferenceIndicates an entity reference where the data string is the name of the referenced entity and the additional information is a pointer to a
CFXMLEntityReferenceInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeDocumentTypeIndicates a document type where the data string is the name given to the top-level element and the additional information is a pointer to a
CFXMLDocumentTypeInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeWhitespaceIndicates white space where the data string is the text of the white space and the additional information is
NULL.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeNotationIndicates a notation where the data string is the notation name and the additional information is a pointer to a
CFXMLNotationInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeElementTypeDeclarationIndicates an element type declaration where the data string is the tag name and the additional information is a pointer to a
CFXMLElementTypeDeclarationInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.kCFXMLNodeTypeAttributeListDeclarationIndicates an attribute list declaration where the data string is the tag name and the additional information is a pointer to a
CFXMLAttributeListDeclarationInfostructure.Available in OS X v10.0 and later.
Declared in
CFXMLNode.h.
Discussion
When the parser encounters a new XML structure, its data type and contents are placed in a CFXMLNode object.
© 2003, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-02-07)