]> err.no Git - sope/blob - sope-appserver/NGObjWeb/Templates/WOHTMLParser.h
fixed some NGMail framework build issue
[sope] / sope-appserver / NGObjWeb / Templates / WOHTMLParser.h
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21
22 #ifndef __WOHTMLParser_H__
23 #define __WOHTMLParser_H__
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   WOHTMLParser
29   
30   This parser parses "old-style" .wo templates. It does *not* process the
31   whole HTML of the file, it only searches for text sections which start
32   with "<#". That way you can process "illegal" HTML code, eg:
33
34     <a href="<#MyLink" />"> ...
35
36   So the syntax is:
37     <#wod-name>...</#wod-name>
38 */
39
40 @class NSString, NSDictionary, NSArray, NSException, NSData;
41 @class WOElement;
42
43 @protocol WOHTMLParserHandler
44
45 - (BOOL)parser:(id)_parser willParseHTMLData:(NSData *)_data;
46 - (void)parser:(id)_parser finishedParsingHTMLData:(NSData *)_data
47   elements:(NSArray *)_elements;
48 - (void)parser:(id)_parser failedParsingHTMLData:(NSData *)_data
49   exception:(NSException *)_exception;
50
51 - (WOElement *)dynamicElementWithName:(NSString *)_element
52   attributes:(NSDictionary *)_attributes // not the associations !
53   contentElements:(NSArray *)_subElements;
54
55 @end
56
57 @interface WOHTMLParser : NSObject
58 {
59   id<NSObject,WOHTMLParserHandler> callback;
60   NSException *parsingException;
61 }
62
63 - (id)initWithHandler:(id<NSObject,WOHTMLParserHandler>)_handler;
64
65 /* accessors */
66
67 - (NSException *)parsingException;
68
69 /* parsing */
70
71 - (NSArray *)parseHTMLData:(NSData *)_html;
72
73 @end
74
75 #endif /* __WOHTMLParser_H__ */