[Previous] [Up]

GSSAXHandler

Authors

Michael Pakhantsov
Richard Frith-Macdonald

Version: $Revision$

Date: $Date$

GSSAXHandler

GSSAXHandler

Declared in: GSXML.h

Inherits from: NSObject


XML SAX Handler.

GSSAXHandler is a callback-based interface to the XML parser that operates in a similar (though not identical) manner to SAX.

Each GSSAXHandler object is associated with a GSXMLParser object. As parsing progresses, the mathods of the GSSAXHandler are invoked by the parser, so the handler is able to deal with the elements and entities being parsed.

The callback methods in the GSSAXHandler class do nothing - it is intended that you subclass GSSAXHandler and override them.

Instance Variables

Methods


Class Methods

handler

+ (GSSAXHandler*) handler;

Create a new SAX handler.



Instances Methods

lib

- (void*) lib;

Return pointer to xmlSAXHandler structure.


parser

- (GSXMLParser*) parser;

Return the parser object with which this handler is associated. This may occasionally be useful.


startDocument

- (void) startDocument;

Called when the document start being processed.


endDocument

- (void) endDocument;

Called when the document end has been detected.


isStandalone

- (int) isStandalone;

Called if the document is standalone.


startElement:attributes:

- (void) startElement: (NSString*)elementName attributes: (NSMutableDictionary*)elementAttributes;

Called when an opening tag has been processed.


endElement

- (void) endElement (NSString*)elementName;

Called when the end of an element has been detected.


attribute:value:

- (void) attribute: (NSString*)name value: (NSString*)value;

Handle an attribute that has been read by the parser.


characters:

- (void) characters: (NSString*)name;

Receiving some chars from the parser.


ignoreWhitespace:

- (void) ignoreWhitespace: (NSString*)ch;

Receiving some ignorable whitespaces from the parser.


processInstruction:value:

- (void) processInstruction: (NSString*)targetName value: (NSString*)PIData;

A processing instruction has been parsed.


comment:

- (void) comment: (NSString*)value;

A comment has been parsed.


cdataBlock:

- (void) cdataBlock: (NSString*)value;

Called when a pcdata block has been parsed.


globalNamespace:href:prefix:

- (void) globalNamespace: (NSString*)name href: (NSString*)href prefix: (NSString*)prefix;

An old global namespace has been parsed.


error:

- (void) error: (NSString*)message;

Called when found a error.


fatalError:

- (void) fatalError: (NSString*)message;

Called when found a fatal error.


warning:

- (void) warning: (NSString*)message;

Called when found a warning.


hasInternalSubset:

- (int) hasInternalSubset:;

Does this document have an internal subset?


hasExternalSubset:

- (int) hasExternalSubset:;

Does this document have an external subset.


internalSubset:externalID:systemID:

- (BOOL) internalSubset: (NSString*)name externalID: (NSString*)externalID systemID: (NSString*)systemID;

Callback on internal subset declaration. Return YES if handled, NO if you want the parser to handle it.


externalSubset:externalID:systemID:

- (BOOL) externalSubset: (NSString*)name externalID: (NSString*)externalID systemID: (NSString*)systemID;

Callback on external subset declaration. Return YES if handled, NO if you want the parser to handle it.


loadEntity:at:

- (NSString*) loadEntity: (NSString*)publicID at: (NSString*)locationURL;

This method controls the loading of external entities into the system. If it returns an empty string, the entity is not loaded. If it returns a filename, the entity is loaded from that file. If it returns nil, the default entity loading mechanism is used.

The default entity loading mechanism is to construct a file name from the locationURL, by replacing all path separators with underscores, then attempt to locate that file in the DTDs resource directory of the main bundle, and all the standard system locations.

As a special case, the default loader examines the publicID and if it is a GNUstep DTD, the loader constructs a special name from the ID (by replacing dots with underscores and spaces with hyphens) and looks for a file with that name and a '.dtd' extension in the GNUstep bundles.


getEntity:

- (void*) getEntity: (NSString*)name;

Get an entity by name.


getParameterEntity:

- (void*) getParameterEntity: (NSString*)name;

Get a parameter entity by name.


namespaceDecl:href:prefix:

- (void) namespaceDecl: (NSString*)name href: (NSString*)href prefix: (NSString*)prefix;

A namespace has been parsed.


notationDecl:systemId:

- (void) notationDecl: (NSString*)publicId systemId: (NSString*)systemId;

What to do when a notation declaration has been parsed.


entityDecl:type:publicId:systemId:content:

- (void) entityDecl: (NSString*)name type: (int)type publicId: (NSString*)publicId systemId: (NSString*)systemId content: (NSString*)content;

An entity definition has been parsed.


attributeDecl:name:type:typeDefValue:defaultValue:

- (void) attributeDecl: (NSString*)nameElement name: (NSString*)name type: (int)type typeDefValue: (int)defType defaultValue: (NSString*)value;

An attribute definition has been parsed.


elementDecl:type:

- (void) elementDecl: (NSString*)name type: (int)type;

An element definition has been parsed.


unparsedEntityDecl:public:system:notationName:

- (void) unparsedEntityDecl: (NSString*)name public: (NSString*)publicId system: (NSString*)systemId notationName: (NSString*)notation;

What to do when an unparsed entity declaration is parsed.


reference:

- (void) reference: (NSString*)name;

Called when an entity reference is detected.