< DOMNode > Protocol Reference
Inheritance diagram for < DOMNode >:
Detailed Description
The DOMNode protocol defines the common interface of all nodes A node can, for example, be an element, a comment or a processing instruction.
One may ask why there is a protocol named DOMNode and a class with the same name. The reason is to increase the extensibility of the framework.
The thought is that when adding new node types, or extensions of existing node types one should not be forced to extend by inheritance (which would be bad design since it couples the extension to tightly to the existing framework).
The DOMNode class is an abstract class for internal use within the framework. A class that extends the framework should conform to the DOMNode protocol not inherit from the DOMNode class.
Public Member Functions |
|
| (NSString *) | nodeName |
| (NSString *) | nodeValue |
| (DOMNodeType) | nodeType |
| (id< DOMParent, DOMNode >) | parentNode |
| (void) | setParentNode: |
| (id< DOMDocument >) | ownerDocument |
| (id< DOMNode >) | detach |
| (BOOL) | isDetached |
| (BOOL) | hasChildren |
| (id< DOMNode >) | previousSibling |
| (id< DOMNode >) | nextSibling |
| (NSString *) | textContent |
| (void) | setTextContent: |
| (BOOL) | isEqualToNode: |
Member Function Documentation
|
|
Detaches this node from it's parent. A detached node belongs to no parent and no document, it is free. When detached, the node removes itself from it's parent's list of children, and removes the reference to it's parent. A document node or document fragment can't be detached.
|
|
|
Returns YES if this node has child nodes. |
|
|
Returns whether or not this method is detached. Returns YES if this node has no parent and NO otherwise. A document or document fragment is never detached.
|
|
|
Checks for equality, as defined by being of the same node type and having the same properties. The implementation of this method depends heavily on which type of node it is, it can be very expensive when the node is a parent since it checks for equality recursively. See NSArray's isEqualToArray: for more information. When comparing text nodes, CDATA sections and comments, ignorable whitespace is ignored. Ignoreable whitespace is, in this framework, defined as the characters in the set returned by NSCharacterSet's whitespaceAndNewlineCharacterSet. |
|
|
Returns the node after this node in the node's parent's list of children, or nil if this node is the last |
|
|
Returns the name of this node. The name and value of a node varies accordning to the table below:
Node type name value ------------------------------------------------------------ Attribute name of attribute value CDATASection "#cdata-section" content Comment "#comment" content Document "#document" nil DocumentFragment "#document-fragment" nil DocumentType document type name nil Element element name nil PI target content, w/o target Text "#text" content |
|
|
|
|
|
Returns the value of this node. The name and value of a node varies accordning to the type, see the table in the documentation of nodeName: for more information. |
|
|
Returns the document this node is placed in or nil, if the node is not part of a document. A node is considered part of a document if it's parent is part of that document, or the node is the document element of a document. |
|
|
Returns the parent of this node or nil, if the node has no parent. |
|
|
Returns the node before this node in the node's parent's list of children, or nil if this node is the first. |
|
|
Sets the parent of this node. It's your responsibility to make sure that the node is added to the new parent, it is not done automatically. Please note that in order to prevent retain-cycles the node does NOT retain the parent. |
|
|
Sets the text contained by this node. The result of this method depends on the node type, see table below:
Node type setTextContent
------------------------------------------------------------
Attribute same as -setValue
CDATASection same as -setData
Comment same as -setData
Text same as -setData
PI same as -setDataString
DocumentFragment all children are removed and replaced by
& Elemenet a single text node
DocumentType no effect
Document no effect
|
|
|
Returns the text contained by this node. The result of this method depends on the node type, see table below:
Node type textContent ------------------------------------------------------------ Attribute same as -nodeValue CDATASection same as -nodeValue Comment same as -nodeValue Text same as -nodeValue PI same as -nodeValue DocumentFragment concatenation of textContent of all & Element children, excluding comments and pi's DocumentType nil Document nil |