2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "SaxXMLFilter.h"
26 @implementation SaxXMLFilter
28 - (id)initWithParent:(id<NSObject,SaxXMLReader>)_parent {
29 if ((self = [self init])) {
30 [self setParent:_parent];
36 [self->parent release];
40 - (void)setParent:(id<NSObject,SaxXMLReader>)_parent {
41 if (self->parent == _parent)
44 [self->parent setContentHandler:nil];
45 [self->parent setDTDHandler:nil];
46 [self->parent setErrorHandler:nil];
47 [self->parent setEntityResolver:nil];
49 ASSIGN(self->parent, _parent);
51 [self->parent setContentHandler:self];
52 [self->parent setDTDHandler:self];
53 [self->parent setErrorHandler:self];
54 [self->parent setEntityResolver:self];
57 - (id<NSObject,SaxXMLReader>)parent {
61 /* features & properties */
63 - (void)setFeature:(NSString *)_name to:(BOOL)_value {
64 [self->parent setFeature:_name to:_value];
66 - (BOOL)feature:(NSString *)_name {
67 return [self->parent feature:_name];
70 - (void)setProperty:(NSString *)_name to:(id)_value {
71 [self->parent setProperty:_name to:_value];
73 - (id)property:(NSString *)_name {
74 return [self->parent property:_name];
79 - (void)setDTDHandler:(id<NSObject,SaxDTDHandler>)_handler {
80 ASSIGN(self->dtdHandler, _handler);
82 - (id<NSObject,SaxDTDHandler>)dtdHandler {
83 return self->dtdHandler;
86 - (void)setErrorHandler:(id<NSObject,SaxErrorHandler>)_handler {
87 ASSIGN(self->errorHandler, _handler);
89 - (id<NSObject,SaxErrorHandler>)errorHandler {
90 return self->errorHandler;
93 - (void)setEntityResolver:(id<NSObject,SaxEntityResolver>)_handler {
94 ASSIGN(self->entityResolver, _handler);
96 - (id<NSObject,SaxEntityResolver>)entityResolver {
97 return self->entityResolver;
100 - (void)setContentHandler:(id<NSObject,SaxContentHandler>)_handler {
101 ASSIGN(self->contentHandler, _handler);
103 - (id<NSObject,SaxContentHandler>)contentHandler {
104 return self->contentHandler;
109 - (void)parseFromSource:(id)_source {
110 [self->parent parseFromSource:_source];
112 - (void)parseFromSystemId:(NSString *)_sysId {
113 [self->parent parseFromSystemId:_sysId];
116 - (void)parseFromSource:(id)_source systemId:(NSString *)_sysId {
117 [self->parent parseFromSource:_source systemId:_sysId];
120 /* SaxEntityResolver */
122 - (id)resolveEntityWithPublicId:(NSString *)_pubId
123 systemId:(NSString *)_sysId
125 return [self->entityResolver resolveEntityWithPublicId:_pubId systemId:_sysId];
128 /* SaxContentHandler */
130 - (void)startDocument {
131 [self->contentHandler startDocument];
133 - (void)endDocument {
134 [self->contentHandler endDocument];
137 - (void)startPrefixMapping:(NSString *)_prefix uri:(NSString *)_uri {
138 [self->contentHandler startPrefixMapping:_prefix uri:_uri];
140 - (void)endPrefixMapping:(NSString *)_prefix {
141 [self->contentHandler endPrefixMapping:_prefix];
144 - (void)startElement:(NSString *)_localName
145 namespace:(NSString *)_ns
146 rawName:(NSString *)_rawName
147 attributes:(id<SaxAttributes>)_attributes
149 [self->contentHandler startElement:_localName namespace:_ns
150 rawName:_rawName attributes:_attributes];
152 - (void)endElement:(NSString *)_localName
153 namespace:(NSString *)_ns
154 rawName:(NSString *)_rawName
156 [self->contentHandler endElement:_localName namespace:_ns rawName:_rawName];
159 - (void)characters:(unichar *)_chars length:(int)_len {
160 [self->contentHandler characters:_chars length:_len];
162 - (void)ignorableWhitespace:(unichar *)_chars length:(int)_len {
163 [self->contentHandler ignorableWhitespace:_chars length:_len];
165 - (void)processingInstruction:(NSString *)_pi data:(NSString *)_data {
166 [self->contentHandler processingInstruction:_pi data:_data];
168 - (void)setDocumentLocator:(id<NSObject,SaxLocator>)_locator {
169 [self->contentHandler setDocumentLocator:_locator];
171 - (void)skippedEntity:(NSString *)_entityName {
172 [self->contentHandler skippedEntity:_entityName];
177 - (void)warning:(SaxParseException *)_exception {
178 [self->errorHandler warning:_exception];
180 - (void)error:(SaxParseException *)_exception {
181 [self->errorHandler error:_exception];
183 - (void)fatalError:(SaxParseException *)_exception {
184 [self->errorHandler fatalError:_exception];
189 - (void)notationDeclaration:(NSString *)_name
190 publicId:(NSString *)_pubId
191 systemId:(NSString *)_sysId
193 [self->dtdHandler notationDeclaration:_name publicId:_pubId systemId:_sysId];
196 - (void)unparsedEntityDeclaration:(NSString *)_name
197 publicId:(NSString *)_pubId
198 systemId:(NSString *)_sysId
199 notationName:(NSString *)_notName
201 [self->dtdHandler unparsedEntityDeclaration:_name
202 publicId:_pubId systemId:_sysId
203 notationName:_notName];
206 @end /* SaxXMLFilter */