[Previous] [Up] [Next]

GSXMLParser

Authors

Michael Pakhantsov
Richard Frith-Macdonald

Version: 0.1

Date: 15 September, 2000

GSXMLParser

GSXMLParser

Declared in: GSXML.h

Inherits from: NSObject


XML Parser.

Instance Variables

Methods


Class Methods

parser:

+ (GSXMLParser*) parser: (id)source;

Creation of a new Parser.

Source must be NSString or NSData.

example

  GSXMLParser       *p = [GSXMLParser parser:@"macos.xml"];

  if ([p parse])
    {
      [[p doc] dump];
    }
  else
    {
      printf("error parse file\n");
    }

            

parserWithSAXHandler:source:

+ (GSXMlParser*) parserWithSAXHandler: (GSSAXHandler*)handler source: (id)source;

Creation of a new Parser with SAX handler.

example

  NSAutoreleasePool *arp = [[NSAutoreleasePool alloc] init];
  GSSAXHandler *h = [GSDebugSAXHandler handler];
  GSXMLParser       *p = [GSXMLParser parserWithSAXHandler: h
						    source: @"macos.xml"];

  if ([p parse])
    {
       printf("ok\n");
    }


  [arp release];
            


Instances Methods

initWithSAXHandler:source:

This is the designated initialiser
- (id) initWithSAXHandler: (GSSAXHandler*)handler source: (id)source;

Creation of a new Parser with SAX handler.


lib

- (void*) lib;

Return pointer to xmlParserCtxt structure.


doc

- (GSXMLDocument*) doc;

Return GSXMLDocument object.


parse

- (BOOL) parse;

Parse source. Return YES if parsed, otherwise NO.

example

  GSXMLParser       *p = [GSXMLParser parser:@"macos.xml"];

  if ([p parse])
    {
      [[p doc] dump];
    }
  else
    {
      printf("error parse file\n");
    }

            

substituteEntites:

- (BOOL) substituteEntites: (BOOL)yesno;

Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output.


keepBlanks:

- (BOOL) keepBlanks: (BOOL)yesno;

Set and return the previous value for default blanks text nodes support. ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content.


getWarnings:

- (BOOL) getWarnings: (BOOL)yesno;

doValidityChecking:

- (BOOL) doValidityChecking: (BOOL)yesno;

Sets whether the document needs to be validated.


errNo

- (int) errNo;

Return error code.


setExternalEntityLoader

- (void) setExternalEntityLoader (void*)function;

Set a external entity loader.