]> err.no Git - sope/blob - sope-xml/SaxObjC/SaxMethodCallHandler.h
removed linking against scripting libs
[sope] / sope-xml / SaxObjC / SaxMethodCallHandler.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __SaxMethodCallHandler_H__
24 #define __SaxMethodCallHandler_H__
25
26 #include <SaxObjC/SaxDefaultHandler.h>
27 #import <Foundation/NSMapTable.h>
28
29 @class NSString, NSMutableArray, NSMutableDictionary;
30
31 /*
32   [also take a look at SaxObjectDecoder]
33   
34   This handler calls a method on a delegate for each tag. The selector is
35   constructed this way:
36   
37     [start|end] + nskey + tagname + ':'
38
39   If no method could be found for the tag, it is first checked whether the
40   delegate responds to
41
42     [start|end] + nskey + 'unknownTag:attributes:'
43
44   and it this couldn't be found, it is checked for
45
46     [start|end] + 'tag:_tagName namespace:_ns attributes:'
47
48   If no key could be found for a namespace, it is first checked whether the
49   delegate responds to
50
51     [start|end] + 'any_' + tagname + ':'
52
53   if this fails it is checked for this selector
54
55     [start|end] + 'tag:_tagName namespace:_ns attributes:'
56
57   if neither exists, the tag is ignored.
58   
59   Eg:
60
61     nskey='xhtml' startKey='start_' endKey='end_'
62     - (void)start_xhtml_br:(id<SaxAttributes>)_attrs;
63     - (void)end_xhtml_br;
64 */
65
66 @interface SaxMethodCallHandler : SaxDefaultHandler
67 {
68   id                  delegate; // non-retained: default=self (for subclasses)
69   NSMutableDictionary *namespaceToKey;
70   NSMutableArray      *tagStack;
71   NSString            *startKey;            // default: 'start_'
72   NSString            *endKey;              // default: 'end_'
73   NSString            *unknownNamespaceKey; // default: 'any_'
74   int                 ignoreLevel;
75   
76   /* processing */
77   NSMapTable      *fqNameToStartSel;
78   NSMutableString *selName; /* reused for each construction */
79 }
80
81 /* namespaces */
82
83 - (void)registerNamespace:(NSString *)_namespace withKey:(NSString *)_key;
84
85 /* keys */
86
87 - (void)setStartKey:(NSString *)_s;
88 - (NSString *)startKey;
89 - (void)setEndKey:(NSString *)_s;
90 - (NSString *)endKey;
91 - (void)setUnknownNamespaceKey:(NSString *)_s;
92 - (NSString *)unknownNamespaceKey;
93
94 /* tag stack */
95
96 - (NSArray *)tagStack;
97 - (unsigned)depth;
98
99 - (void)ignoreChildren;
100 - (BOOL)doesIgnoreChildren;
101
102 /* delegate */
103
104 - (void)setDelegate:(id)_delegate;
105 - (id)delegate;
106
107 @end
108
109 #endif /* __SaxMethodCallHandler_H__ */