2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "SaxXMLFilter.h"
25 @implementation SaxXMLFilter
27 - (id)initWithParent:(id<NSObject,SaxXMLReader>)_parent {
28 if ((self = [self init])) {
29 [self setParent:_parent];
35 [self->parent release];
39 - (void)setParent:(id<NSObject,SaxXMLReader>)_parent {
40 if (self->parent == _parent)
43 [self->parent setContentHandler:nil];
44 [self->parent setDTDHandler:nil];
45 [self->parent setErrorHandler:nil];
46 [self->parent setEntityResolver:nil];
48 ASSIGN(self->parent, _parent);
50 [self->parent setContentHandler:self];
51 [self->parent setDTDHandler:self];
52 [self->parent setErrorHandler:self];
53 [self->parent setEntityResolver:self];
56 - (id<NSObject,SaxXMLReader>)parent {
60 /* features & properties */
62 - (void)setFeature:(NSString *)_name to:(BOOL)_value {
63 [self->parent setFeature:_name to:_value];
65 - (BOOL)feature:(NSString *)_name {
66 return [self->parent feature:_name];
69 - (void)setProperty:(NSString *)_name to:(id)_value {
70 [self->parent setProperty:_name to:_value];
72 - (id)property:(NSString *)_name {
73 return [self->parent property:_name];
78 - (void)setDTDHandler:(id<NSObject,SaxDTDHandler>)_handler {
79 ASSIGN(self->dtdHandler, _handler);
81 - (id<NSObject,SaxDTDHandler>)dtdHandler {
82 return self->dtdHandler;
85 - (void)setErrorHandler:(id<NSObject,SaxErrorHandler>)_handler {
86 ASSIGN(self->errorHandler, _handler);
88 - (id<NSObject,SaxErrorHandler>)errorHandler {
89 return self->errorHandler;
92 - (void)setEntityResolver:(id<NSObject,SaxEntityResolver>)_handler {
93 ASSIGN(self->entityResolver, _handler);
95 - (id<NSObject,SaxEntityResolver>)entityResolver {
96 return self->entityResolver;
99 - (void)setContentHandler:(id<NSObject,SaxContentHandler>)_handler {
100 ASSIGN(self->contentHandler, _handler);
102 - (id<NSObject,SaxContentHandler>)contentHandler {
103 return self->contentHandler;
108 - (void)parseFromSource:(id)_source {
109 [self->parent parseFromSource:_source];
111 - (void)parseFromSystemId:(NSString *)_sysId {
112 [self->parent parseFromSystemId:_sysId];
115 - (void)parseFromSource:(id)_source systemId:(NSString *)_sysId {
116 [self->parent parseFromSource:_source systemId:_sysId];
119 /* SaxEntityResolver */
121 - (id)resolveEntityWithPublicId:(NSString *)_pubId
122 systemId:(NSString *)_sysId
124 return [self->entityResolver resolveEntityWithPublicId:_pubId systemId:_sysId];
127 /* SaxContentHandler */
129 - (void)startDocument {
130 [self->contentHandler startDocument];
132 - (void)endDocument {
133 [self->contentHandler endDocument];
136 - (void)startPrefixMapping:(NSString *)_prefix uri:(NSString *)_uri {
137 [self->contentHandler startPrefixMapping:_prefix uri:_uri];
139 - (void)endPrefixMapping:(NSString *)_prefix {
140 [self->contentHandler endPrefixMapping:_prefix];
143 - (void)startElement:(NSString *)_localName
144 namespace:(NSString *)_ns
145 rawName:(NSString *)_rawName
146 attributes:(id<SaxAttributes>)_attributes
148 [self->contentHandler startElement:_localName namespace:_ns
149 rawName:_rawName attributes:_attributes];
151 - (void)endElement:(NSString *)_localName
152 namespace:(NSString *)_ns
153 rawName:(NSString *)_rawName
155 [self->contentHandler endElement:_localName namespace:_ns rawName:_rawName];
158 - (void)characters:(unichar *)_chars length:(int)_len {
159 [self->contentHandler characters:_chars length:_len];
161 - (void)ignorableWhitespace:(unichar *)_chars length:(int)_len {
162 [self->contentHandler ignorableWhitespace:_chars length:_len];
164 - (void)processingInstruction:(NSString *)_pi data:(NSString *)_data {
165 [self->contentHandler processingInstruction:_pi data:_data];
167 - (void)setDocumentLocator:(id<NSObject,SaxLocator>)_locator {
168 [self->contentHandler setDocumentLocator:_locator];
170 - (void)skippedEntity:(NSString *)_entityName {
171 [self->contentHandler skippedEntity:_entityName];
176 - (void)warning:(SaxParseException *)_exception {
177 [self->errorHandler warning:_exception];
179 - (void)error:(SaxParseException *)_exception {
180 [self->errorHandler error:_exception];
182 - (void)fatalError:(SaxParseException *)_exception {
183 [self->errorHandler fatalError:_exception];
188 - (void)notationDeclaration:(NSString *)_name
189 publicId:(NSString *)_pubId
190 systemId:(NSString *)_sysId
192 [self->dtdHandler notationDeclaration:_name publicId:_pubId systemId:_sysId];
195 - (void)unparsedEntityDeclaration:(NSString *)_name
196 publicId:(NSString *)_pubId
197 systemId:(NSString *)_sysId
198 notationName:(NSString *)_notName
200 [self->dtdHandler unparsedEntityDeclaration:_name
201 publicId:_pubId systemId:_sysId
202 notationName:_notName];
205 @end /* SaxXMLFilter */