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