Up

NSXMLNode class documentation

Authors

Generated by fedor

Software documentation for the NSXMLNode class

NSXMLNode : NSObject

Declared in:
Foundation/NSXMLNode.h
Conforms to:
NSCopying
Availability: OpenStep

The most primitive unit in an XML document.

Instance Variables

Method summary

DTDNodeWithXMLString: 

+ (id) DTDNodeWithXMLString: (NSString*)string;
Availability: OpenStep

Creates and returns a DTD node from the supplied string. The node might describe element, attribute, entity, or notation.

attributeWithName: URI: stringValue: 

+ (id) attributeWithName: (NSString*)name URI: (NSString*)URI stringValue: (NSString*)stringValue;
Availability: OpenStep

Creates and returns an attribute node with the specified (fully qualified) name, namespace URI, and value.

attributeWithName: stringValue: 

+ (id) attributeWithName: (NSString*)name stringValue: (NSString*)stringValue;
Availability: OpenStep

Creates and returns an attribute node with the specified name and value.

commentWithStringValue: 

+ (id) commentWithStringValue: (NSString*)stringValue;
Availability: OpenStep

Creates and returns a comment node with the supplied text.

document 

+ (id) document;
Availability: OpenStep

Creates and returns an empty document... convenience method.

documentWithRootElement: 

+ (id) documentWithRootElement: (NSXMLElement*)element;
Availability: OpenStep

Creates and returns a new document intialised with the supplied root node.

elementWithName: 

+ (id) elementWithName: (NSString*)name;
Availability: OpenStep

Creates and returns a node node with the specified name.

elementWithName: URI: 

+ (id) elementWithName: (NSString*)name URI: (NSString*)URI;
Availability: OpenStep

Creates and returns a node with the supplied (fully qualified name) an namespace URI.

elementWithName: children: attributes: 

+ (id) elementWithName: (NSString*)name children: (NSArray*)children attributes: (NSArray*)attributes;
Availability: OpenStep

Creates and returns a node containing the supplied child nodes and with the attribute nodes from the supplied array.

elementWithName: stringValue: 

+ (id) elementWithName: (NSString*)name stringValue: (NSString*)string;
Availability: OpenStep

Creates and returns a node with the pecified name and with a single text node (containing string) as its content.

localNameForName: 

+ (NSString*) localNameForName: (NSString*)name;
Availability: OpenStep

Strips any leading namespace prefix from name and returns the result.

namespaceWithName: stringValue: 

+ (id) namespaceWithName: (NSString*)name stringValue: (NSString*)stringValue;
Availability: OpenStep

Creates and returns a node mapping the supplkied namespace name to the string value (URI).

predefinedNamespaceForPrefix: 

+ (NSXMLNode*) predefinedNamespaceForPrefix: (NSString*)name;
Availability: OpenStep

Returns the namespace node corresponding to a predefined namespace names (one of xml, xs, or xsi)

prefixForName: 

+ (NSString*) prefixForName: (NSString*)name;
Availability: OpenStep

Returns the namespace prefix of name.

processingInstructionWithName: stringValue: 

+ (id) processingInstructionWithName: (NSString*)name stringValue: (NSString*)stringValue;
Availability: OpenStep

Creates and return a processinc insruction node with th specified name and textual value.

textWithStringValue: 

+ (id) textWithStringValue: (NSString*)stringValue;
Availability: OpenStep

Creates and returns a simple text node.

URI 

- (NSString*) URI;
Availability: OpenStep

Returns the URI of the receiver.

XMLString 

- (NSString*) XMLString;
Availability: OpenStep

Returns the text of the receiver as XML (ie in the form it would have in an XML document).

XMLStringWithOptions: 

- (NSString*) XMLStringWithOptions: (NSUInteger)theOptions;
Availability: OpenStep

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 

- (NSString*) XPath;
Availability: OpenStep

Returns the XPath string to access the receiver with the document.

canonicalXMLStringPreservingComments: 

- (NSString*) canonicalXMLStringPreservingComments: (BOOL)comments;
Availability: OpenStep

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: 

- (NSXMLNode*) childAtIndex: (NSUInteger)index;
Availability: OpenStep

Returns the child node if the receiver at the specified index.

childCount 

- (NSUInteger) childCount;
Availability: OpenStep

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 

- (NSArray*) children;
Availability: OpenStep

Returns n array containing the immediate child nodes of the receiver.

detach 

- (void) detach;
Availability: OpenStep

Detaches the receiver from its parent node.

index 

- (NSUInteger) index;
Availability: OpenStep

Return the index of the receiver within its parent node.

initWithKind: 

- (id) initWithKind: (NSXMLNodeKind)theKind;
Availability: OpenStep

Initialises the receiver as a specific kind of node.
Calls -initWithKind:options: using NSXMLNodeOptionsNone and returns the result.

initWithKind: options: 

- (id) initWithKind: (NSXMLNodeKind)theKind options: (NSUInteger)theOptions;
Availability: OpenStep

This is a designated initialiser for the class.
Initialises the receiver as the specified kind of node and with the specified options.

kind 

- (NSXMLNodeKind) kind;
Availability: OpenStep

Returns the kind of node represented by the receiver.

level 

- (NSUInteger) level;
Availability: OpenStep

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 

- (NSString*) localName;
Availability: OpenStep

Returns the name of the receiver without any namespace prefix.

name 

- (NSString*) name;
Availability: OpenStep

Returns the name of the receiver.

nextNode 

- (NSXMLNode*) nextNode;
Availability: OpenStep

Returns the next node in the tree.

nextSibling 

- (NSXMLNode*) nextSibling;
Availability: OpenStep

Returns the next sibling of the receiver

nodesForXPath: error: 

- (NSArray*) nodesForXPath: (NSString*)anxpath error: (NSError**)error;
Availability: OpenStep

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 

- (id) objectValue;
Availability: OpenStep

Returns the object value of the receiver (as set using -setObjectValue:) or nil if there is none.

objectsForXQuery: constants: error: 

- (NSArray*) objectsForXQuery: (NSString*)xquery constants: (NSDictionary*)constants error: (NSError**)error;
Availability: OpenStep

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: error: 

- (NSArray*) objectsForXQuery: (NSString*)xquery error: (NSError**)error;
Availability: OpenStep

Returns the data resulting from calling the query on the receiver.
The same as objectsForXQuery:constants:error: without the constants.

parent 

- (NSXMLNode*) parent;
Availability: OpenStep

Returns the parent node of the receiver or nil if the receiver is not within another node.

prefix 

- (NSString*) prefix;
Availability: OpenStep

Returns the namepsace prefix for the receiver or nil if there is no namespace prefix.

previousNode 

- (NSXMLNode*) previousNode;
Availability: OpenStep

Returns the previous node in the tree... stepping through the tree backwards.

previousSibling 

- (NSXMLNode*) previousSibling;
Availability: OpenStep

Description forthcoming.

rootDocument 

- (NSXMLDocument*) rootDocument;
Availability: OpenStep

Returns the document containing the receiver, or nil if the receiver does not lie within a document.

setName: 

- (void) setName: (NSString*)name;
Availability: OpenStep

Sets the name of the receiver.

setObjectValue: 

- (void) setObjectValue: (id)value;
Availability: OpenStep

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: 

- (void) setStringValue: (NSString*)string;
Availability: OpenStep

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: resolvingEntities: 

- (void) setStringValue: (NSString*)string resolvingEntities: (BOOL)resolve;
Availability: OpenStep

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: 

- (void) setURI: (NSString*)URI;
Availability: OpenStep

Sets the URI of the receiver.

stringValue 

- (NSString*) stringValue;
Availability: OpenStep

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.



Instance Variables for NSXMLNode Class

_internal

@public GSInternal* _internal;
Availability: OpenStep

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.





Up