# NSXMLNode class documentation

rfm@gnu.org
Generated at 2025-02-13 06:02:40 +0000
2008 Free Software Foundation, Inc.
Software documentation for the NSXMLNode class
Foundation/NSXMLNode.h
NSCopying
The most primitive unit in an XML document.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
DTDNodeWithXMLString:
string
Creates and returns a DTD node from the supplied string. The node might describe element, attribute, entity, or notation.
attributeWithName:
name
URI:
URI
stringValue:
stringValue
Creates and returns an attribute node with the specified (fully qualified) name, namespace URI, and value.
attributeWithName:
name
stringValue:
stringValue
Creates and returns an attribute node with the specified name and value.
commentWithStringValue:
stringValue
Creates and returns a comment node with the supplied text.
document
Creates and returns an empty document... convenience method.
documentWithRootElement:
element
Creates and returns a new document intialised with the supplied root node.
elementWithName:
name
Creates and returns a node node with the specified name.
elementWithName:
name
URI:
URI
Creates and returns a node with the supplied (fully qualified name) an namespace URI.
elementWithName:
name
children:
children
attributes:
attributes
Creates and returns a node containing the supplied child nodes and with the attribute nodes from the supplied array.
elementWithName:
name
stringValue:
string
Creates and returns a node with the pecified name and with a single text node (containing string) as its content.
localNameForName:
name
Strips any leading namespace prefix from name and returns the result.
namespaceWithName:
name
stringValue:
stringValue
Creates and returns a node mapping the supplkied namespace name to the string value (URI).
predefinedNamespaceForPrefix:
name
Returns the namespace node corresponding to a predefined namespace names (one of xml, xs, or xsi)
prefixForName:
name
Returns the namespace prefix of name.
processingInstructionWithName:
name
stringValue:
stringValue
Creates and return a processinc insruction node with th specified name and textual value.
textWithStringValue:
stringValue
Creates and returns a simple text node.
URI
Returns the URI of the receiver.
XMLString
Returns the text of the receiver as XML (ie in the form it would have in an XML document).
XMLStringWithOptions:
theOptions
Returns the text of the receiver as XML (ie in the form it would have in an XML document), with the specified options controlling it.
XPath
Returns the XPath string to access the receiver with the document.
canonicalXMLStringPreservingComments:
comments
Returns the canonical form (see http://www.w3.org/TR/xml-c14n) of the receiveri as long as the NSXMLNodePreserveWhitespace has been set. If the option as not been set, return the same without white space preserved.
childAtIndex:
index
Returns the child node if the receiver at the specified index.
childCount
Returns the number of immediate child nodes of the receiver.
This method is more efficient than getting the array of children and counting it.
children
Returns n array containing the immediate child nodes of the receiver.
detach
Detaches the receiver from its parent node.
index
Return the index of the receiver within its parent node.
initWithKind:
theKind
Initialises the receiver as a specific kind of node.
Calls -initWithKind:options: using NSXMLNodeOptionsNone and returns the result.
initWithKind:
theKind
options:
theOptions
Initialises the receiver as the specified kind of node and with the specified options.
kind
Returns the kind of node represented by the receiver.
level
Return the level of the receiver within the tree of nodes.
A document or a node which is not inside another is at level 0.
localName
Returns the name of the receiver without any namespace prefix.
name
Returns the name of the receiver.
nextNode
Returns the next node in the tree.
nextSibling
Returns the next sibling of the receiver
nodesForXPath:
anxpath
error:
error
Returns the nodes resulting from applying xpath to the receiver.
Before using xpath on a tree, you must call the -normalizeAdjacentTextNodesPreservingCDATA: with `NO` as the argument, in order to avoid problems where the xpath syntax cannot cope with multiple text nodes.
objectValue
Returns the object value of the receiver (as set using -setObjectValue:) or `nil` if there is none.
objectsForXQuery:
xquery
constants:
constants
error:
error
Returns the data resulting from calling the query on the receiver.
Before using xpath on a tree, you must call the -normalizeAdjacentTextNodesPreservingCDATA: with `NO` as the argument, in order to avoid problems where the xpath syntax cannot cope with multiple text nodes.
The value of constants is a dictionary of constants declared to be "external" in the query.
The resulting array amy contain array, data, date, number, string, and URL objects as well as nodes.
objectsForXQuery:
xquery
error:
error
Returns the data resulting from calling the query on the receiver.
The same as objectsForXQuery:constants:error: without the constants.
parent
Returns the parent node of the receiver or `nil` if the receiver is not within another node.
prefix
Returns the namepsace prefix for the receiver or `nil` if there is no namespace prefix.
previousNode
Returns the previous node in the tree... stepping through the tree backwards.
previousSibling
Description forthcoming.
rootDocument
Returns the document containing the receiver, or `nil` if the receiver does not lie within a document.
setName:
name
Sets the name of the receiver.
setObjectValue:
value
Sets the content of the receiver, removing any existing children (including comments and processing instructions).
For an element node, this sets text contetn within the node.
setStringValue:
string
Sets the content of the receiver to be the supplied string value... which involves removing existing content, comments, and processing instructions.
If the receiver is an element node, this creates a text node containing the string value as the sole child of the receiver.
setStringValue:
string
resolvingEntities:
resolve
Sets the string content of the receiver.
if the resolve flag is `YES` then any entities which can be resolved are replaced by the resolved versions.
setURI:
URI
Sets the URI of the receiver.
stringValue
Returns the string value of the receiver. For kinds of node which have direct string content, this simply returns that content. For elements this recursively traverses the children of the receiver appending the text of each child to a single string result.