[Previous] [Up] [Next]

GSXMLDocument

Authors

Michael Pakhantsov

Version: $Revision$

Date: $Date$

GSXMLDocument

GSXMLDocument

Declared in: GSXML.h

Inherits from: NSObject


XML Document.

Instance Variables

Methods


Class Methods

documentWithVersion:

+ (GSXMLDocument*) documentWithVersion: (NSString*)version;

Creation of a new XML document.

example


  id 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 makeComment: @" this is a comment "];
  [n1 makePI: @"pi1" content: @"this is a process instruction"];
  [n1 makeChildWithNamespace: nil name: @"key" content: @"Year Of Birth"];
  [n1 makeChildWithNamespace: nil name: @"integer" content: @"65"];
  [n1 makeChildWithnamespace: nil name: @"key" content: @"Pets Names"];

	    
 

documentFrom:

+ (GSXMLDocument*) documentFrom: (void*)data;

Creation of a new Document from libxml data.



Instances Methods

initWithVersion:

- (id) initWithVersion: (NSString*)version;

Creation of a new XML document.


initFrom:

This is the designated initialiser
- (id) initFrom: (void*)data;

Creation of a new Document from libxml data.


version

- (NSString*) version;

Return the version of document.


encoding

- (NSString*) encoding;

Return the encoding of document.


save:

- (void) save: (NSString*)filename;

Save XML document.


lib

- (void*) lib;

Return pointer to xmlDoc structure.


root

- (GSXMLNode*) root;

Return the root name of document.


setRoot:

- (GSXMLNode*) setRoot: (GSXMLNode*)node;

Set the root element of the document. Return the old root element.


makeNodeWithNamespace:name:content:

- (GSXMLDocument*) makeNodeWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name content: (NSString*)content;

Creation of a new node element within a document.

example


  GSXMLNode *n1, *n2;
  GSXMLDocument *d;

  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];