Version: $Revision$
Date: $Date$
Declared in: GSXML.h
Inherits from: NSObject
XML Node.
Return the string constant value for the node type given.
Return the numeric constant value for the node type named. This method is inefficient, so the returned value should be saved for re-use later. The possible values are -
Creation of a new Node. This function will refuse to create a Node with a similar prefix than an existing one present on this node.
example... GSXMLNamespace *ns1; GSXMLNode *node1, *node2; NSString *prefix = @"mac-os-property"; NSString *href = @"http://www.gnustep.org/some/location"; ns = [GSXMLNamespace namespaceWithNode: nil href: href prefix: prefix]; node1 = [GSXMLNode nodeWithNamespace: ns name: @"node1"]; node2 = [GSXMLNode nodeWithNamespace: nil name: @"node2"]; ...
Creation of a new Node from libxml data.
Creation of a new node elemen, ns is optional (nil).
Creation of a new Node from libxml data.
Return pointer to xmlNode structure.
Return Node name.
Return Node content.
Return Node namespace.
Return namespace definitions of this node.
Return pointer to the first attribute on this node.
exampleGSXMLNode *n1; GSXMLAttribute *a; n1 = [GSXMLNode nodeWithNamespace: nil name: nodeName]; [n1 setProp: @"prop1" value: @"value1"]; [n1 setProp: @"prop2" value: @"value2"]; [n1 setProp: @"prop3" value: @"value3"]; a = [n1 properties]; NSLog(@"n1 property name - %@ value - %@", [a name], [a value]); while ((a = [a next]) != nil) { NSLog(@"n1 property name - %@ value - %@", [a name], [a value]); }
Return attributes and values as a dictionary.
exampleGSXMLNode *n1; NSMutableDictionary *prop; NSEnumerator *e; id key; prop = [n1 propertiesAsDictionary]; e = [prop keyEnumerator]; while ((key = [e nextObject]) != nil) { NSLog(@"property name - %@ value - %@", key, [prop objectForKey: key]); }
Return attributes and values as a dictionary, but applies the specified selector to each key before adding the key and value to the dictionary. The selector must be a method of NSString taking no arguments and returning an object suitable for use as a dictionary key.
This method exists for the use of GSWeb ... it is probably not of much use elsewhere.
Return type of Node.
Return the name of the type of the Node.
Return owner of this node.
Return children of this node.
example- (GSXMLNode*) nextElement: (GSXMLNode*)node { while (node != nil) { if ([node type] == XML_ELEMENT_NODE) { return node; } if ([node children] != nil) { node = [self nextElement: [node children]]; } else node = [node next]; } return node; }
Return parent of this node.
Return next node.
Return previous node.
Creation of a new child element, added at the end of parent children list. ns and content parameters are optional (may be nil). If content is non nil, a child list containing the TEXTs and ENTITY_REFs node will be created. Return previous node.
exampleGSXMLNode *n1, *n2; GSXMLDocument *d, *d1; d = [GSXMLDocument documentWithVersion: @"1.0"]; [d setRoot: [d makeNodeWithNamespace: nil name: @"plist" content: nil]]; [[d root] setProp: @"version" value: @"0.9"]; n1 = [[d root] makeChildWithNamespace: nil name: @"dict" content: nil]; [n1 makeChildWithNamespace: nil name: @"key" content: @"Year Of Birth"]; [n1 makeChildWithNamespace: nil name: @"integer" content: @"65"]; [n1 makeChildWithNamespace: nil name: @"key" content: @"Pets Names"]; [n1 makeChildWithNamespace: nil name: @"array" content: nil];
Creation of a new comment element, added at the end of parent children list.
exampled = [GSXMLDocument documentWithVersion: @"1.0"]; [d setRoot: [d makeNodeWithNamespace: nil name: @"plist" content: nil]]; [[d root] setProp: @"version" value: @"0.9"]; n1 = [[d root] makeChildWithNamespace: nil name: @"dict" content: nil]; [n1 makeComment: @" this is a comment "];
Creation of a new process instruction element, added at the end of parent children list.
exampled = [GSXMLDocument documentWithVersion: @"1.0"]; [d setRoot: [d makeNodeWithNamespace: nil name: @"plist" content: nil]]; [[d root] setProp: @"version" value: @"0.9"]; n1 = [[d root] makeChildWithNamespace: nil name: @"dict" content: nil]; [n1 makeComment: @" this is a comment "]; [n1 makePI: @"pi1" content: @"this is a process instruction"];
Set (or reset) an attribute carried by a node.
exampleid n1 = [GSXMLNode nodeWithNamespace: nil name: nodeName]; [n1 setProp: @"prop1" value: @"value1"]; [n1 setProp: @"prop2" value: @"value2"]; [n1 setProp: @"prop3" value: @"value3"];
Return the numeric type code for this node.
Return the string type code for this node.