+2004-08-25 Helge Hess <helge.hess@opengroupware.org>
+
+ * v4.3.12
+
+ * Templates/WOxTemplateBuilder.m: properly select a DOM builder based
+ on the template extension
+
+ * Templates/WOTemplateBuilder.m, WOComponentDefinition.m: moved
+ builder factory to WOComponentDefinition
+
2004-08-24 Helge Hess <helge.hess@opengroupware.org>
* changed bundles to install in "xxx-4.3" pathes instead of "xxx/4.3"
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id: WOConditional.m 1 2004-08-20 10:08:27Z znek $
#include <NGObjWeb/WODynamicElement.h>
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGObjWeb_WOTemplateBuilder_H__
#define __NGObjWeb_WOTemplateBuilder_H__
{
}
-+ (WOTemplateBuilder *)templateBuilderForPath:(NSString *)_path;
-+ (WOTemplateBuilder *)templateBuilderForURL:(NSURL *)_url;
-
- (WOTemplate *)buildTemplateAtURL:(NSURL *)_url;
@end
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
+// $Id: WOTemplateBuilder.m 1 2004-08-20 10:08:27Z znek $
#include <NGObjWeb/WOTemplateBuilder.h>
#include "common.h"
@implementation WOTemplateBuilder
-static NSArray *woxExtensions = nil;
-
+ (int)version {
- return 1;
-}
-+ (void)initialize {
- NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
- woxExtensions = [[ud arrayForKey:@"WOxFileExtensions"] copy];
+ return 2;
}
-/* builder factory */
-
-+ (WOTemplateBuilder *)templateBuilderForPath:(NSString *)_path {
- NSString *ext;
-
- if ([_path length] == 0)
- return nil;
-
- ext = [_path pathExtension];
- if ([woxExtensions containsObject:ext]) {
- static WOTemplateBuilder *woxBuilder = nil;
- if (woxBuilder == nil)
- woxBuilder = [[NSClassFromString(@"WOxTemplateBuilder") alloc] init];
- return woxBuilder;
- }
-
- {
- static WOTemplateBuilder *woBuilder = nil;
- if (woBuilder == nil) {
- woBuilder =
- [[NSClassFromString(@"WOWrapperTemplateBuilder") alloc] init];
- }
- return woBuilder;
- }
-}
-
-+ (WOTemplateBuilder *)templateBuilderForURL:(NSURL *)_url {
- if ([_url isFileURL])
- return [self templateBuilderForPath:[_url path]];
-
- [self logWithFormat:@"only supports file URLs: %@", _url];
- return nil;
-}
+/* building */
- (WOTemplate *)buildTemplateAtURL:(NSURL *)_url {
#if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#include "WOWrapperTemplateBuilder.h"
#include "WODParser.h"
static NSStringEncoding parserEncoding;
+ (int)version {
- return [super version] + 0 /* v1 */;
+ return [super version] + 0 /* v2 */;
}
+ (void)initialize {
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
- NSAssert2([super version] == 1,
+ NSAssert2([super version] == 2,
@"invalid superclass (%@) version %i !",
NSStringFromClass([self superclass]), [super version]);
static Class DateClass = Nil;
+ (int)version {
- return [super version] + 0 /* v1 */;
+ return [super version] + 0 /* v2 */;
}
+ (void)initialize {
- NSAssert2([super version] == 1,
+ NSAssert2([super version] == 2,
@"invalid superclass (%@) version %i !",
NSStringFromClass([self superclass]), [super version]);
return template;
}
-- (id<DOMBuilder>)xmlParser {
- //static id builder = nil;
+- (id<DOMBuilder>)xmlParserForURL:(NSURL *)_url {
+ static DOMBuilderFactory *factory = nil;
- return [[DOMBuilderFactory standardDOMBuilderFactory]
- createDOMBuilderForMimeType:@"text/xml"];
+ if (factory == nil)
+ factory = [[DOMBuilderFactory standardDOMBuilderFactory] retain];
+
+ // TODO: somewhat hackish
+ if ([[_url path] hasSuffix:@".html"])
+ return [factory createDOMBuilderForMimeType:@"text/html"];
+ if ([[_url path] hasSuffix:@".stx"])
+ return [factory createDOMBuilderForMimeType:@"text/structured"];
+
+ // TODO: do we want to cache the builder?
+ return [factory createDOMBuilderForMimeType:@"text/xml"];
}
- (WOTemplate *)buildTemplateAtURL:(NSURL *)_url {
id<DOMBuilder> builder;
WOTemplate *template;
- //NSLog(@"loading XML template %@ ...", self->path);
+#if 0
+ [self logWithFormat:@"loading XML template %@ ...", self->path];
+#endif
pool = [[NSAutoreleasePool alloc] init];
- builder = [self xmlParser];
+ builder = [self xmlParserForURL:_url];
NSAssert(builder != nil, @"missing XML parser ..");
domDocument = [builder buildFromSource:_url];
- //[@"file://" stringByAppendingString:self->path]];
-
+#if 0
+ [@"file://" stringByAppendingString:self->path]];
+#endif
+
/* construct template for DOM document */
if (domDocument) {
# version file
-SUBMINOR_VERSION:=9
+SUBMINOR_VERSION:=12
# v4.2.413 requires libSaxObjC v4.2.33
# v4.2.341 requires libNGExtensions v4.2.77
static BOOL profLoading = NO;
static BOOL enableClassLessComponents = NO;
static BOOL enableWOOFiles = NO;
+static NSArray *woxExtensions = nil;
+ (int)version {
return 4;
[ud boolForKey:@"WOEnableComponentsWithoutClasses"];
enableWOOFiles = [ud boolForKey:@"WOComponentLoadWOOFiles"];
debugOn = [ud boolForKey:@"WODebugComponentDefinition"];
+ woxExtensions = [[ud arrayForKey:@"WOxFileExtensions"] copy];
}
- (id)initWithName:(NSString *)_name
/* templates */
+- (WOTemplateBuilder *)templateBuilderForPath:(NSString *)_path {
+ NSString *ext;
+
+ if ([_path length] == 0)
+ return nil;
+
+ ext = [_path pathExtension];
+ if ([woxExtensions containsObject:ext]) {
+ static WOTemplateBuilder *woxBuilder = nil;
+ if (woxBuilder == nil)
+ woxBuilder = [[NSClassFromString(@"WOxTemplateBuilder") alloc] init];
+ return woxBuilder;
+ }
+
+ {
+ static WOTemplateBuilder *woBuilder = nil;
+ if (woBuilder == nil) {
+ woBuilder =
+ [[NSClassFromString(@"WOWrapperTemplateBuilder") alloc] init];
+ }
+ return woBuilder;
+ }
+}
+
+- (WOTemplateBuilder *)templateBuilderForURL:(NSURL *)_url {
+ if ([_url isFileURL])
+ return [self templateBuilderForPath:[_url path]];
+
+ [self logWithFormat:@"only supports file URLs: %@", _url];
+ return nil;
+}
+
- (BOOL)load {
WOTemplateBuilder *builder;
NSURL *url;
if (debugOn) [self debugWithFormat:@"url: %@", [url absoluteString]];
// TODO: maybe we should move the builder selection to the resource-manager
- builder = [WOTemplateBuilder templateBuilderForURL:url];
+ builder = [self templateBuilderForURL:url];
if (debugOn) [self debugWithFormat:@"builder: %@", builder];
self->template = [[builder buildTemplateAtURL:url] retain];
/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGExtensions_NSURL_misc_H__
#define __NGExtensions_NSURL_misc_H__
+2004-08-25 Helge Hess <helge.hess@opengroupware.org>
+
+ * DOMSaxHandler.m: do not print DOM parsing errors per default
+ (consumers need to check the errors array) (v4.3.12)
+
2004-08-20 Helge Hess <helge.hess@opengroupware.org>
* moved to SOPE 4.3 (v4.3.11)
/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#include "DOMSaxHandler.h"
#include "DOMImplementation.h"
@implementation DOMSaxHandler
+static BOOL printErrors = NO;
+
- (id)initWithDOMImplementation:(id)_domImpl {
if ((self = [super init])) {
self->dom = [_domImpl retain];
}
- (void)error:(SaxParseException *)_exception {
- NSString *sysId;
- int line;
-
self->errorCount++;
- sysId = [[_exception userInfo] objectForKey:@"systemId"];
- line = [[[_exception userInfo] objectForKey:@"line"] intValue];
+ if (printErrors) {
+ NSString *sysId;
+ int line;
+
+ sysId = [[_exception userInfo] objectForKey:@"systemId"];
+ line = [[[_exception userInfo] objectForKey:@"line"] intValue];
+
+ NSLog(@"DOM XML ERROR(%@:%i[%@]): %@ (errcount=%i,max=%i)", sysId, line,
+ [[_exception userInfo] objectForKey:@"parser"],
+ [_exception reason],
+ self->errorCount, self->maxErrorCount);
+ }
- NSLog(@"DOM XML ERROR(%@:%i[%@]): %@ (errcount=%i,max=%i)", sysId, line,
- [[_exception userInfo] objectForKey:@"parser"],
- [_exception reason],
- self->errorCount, self->maxErrorCount);
-
if (self->errors == nil)
self->errors = [[NSMutableArray alloc] initWithCapacity:32];
-# $Id$
+# $Id: Version 4 2004-08-20 17:04:31Z helge $
-SUBMINOR_VERSION:=11
+SUBMINOR_VERSION:=12
+2004-08-25 Helge Hess <helge.hess@opengroupware.org>
+
+ * v4.3.16
+
+ * libxmlHTMLSAXDriver.m: generate SAX events (HTML/BODY) for empty
+ documents
+
+ * libxmlDocSAXDriver.m, libxmlHTMLSAXDriver.m: allows NSURL objects as
+ the source for parsing
+
2004-08-24 Helge Hess <helge.hess@skyrix.com>
* GNUmakefile: install SAX driver in Library/SaxDrivers-4.3/ (v4.3.15)
-# $Id$
+# version
-SUBMINOR_VERSION:=15
+SUBMINOR_VERSION:=16
/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#import "libxmlDocSAXDriver.h"
#import "libxmlSAXLocator.h"
- (void)parseFromSource:(id)_source systemId:(NSString *)_sysId {
if ([_source isKindOfClass:[NSData class]]) {
[self _parseFromData:_source systemId:nil];
+ return;
}
- else if ([_source isKindOfClass:[NSString class]]) {
+ if ([_source isKindOfClass:[NSString class]]) {
[self _parseFromData:[_source dataUsingEncoding:NSISOLatin1StringEncoding]
systemId:nil];
+ return;
}
- else {
+ if ([_source isKindOfClass:[NSURL class]]) {
+ NSData *data;
+
+ data = [_source isFileURL]
+ ? [NSData dataWithContentsOfMappedFile:[_source path]]
+ : [_source resourceDataUsingCache:YES];
+
+ [self _parseFromData:data systemId:[_source absoluteString]];
+ return;
+ }
+
+ {
SaxParseException *e;
NSDictionary *ui;
nil];
e = (id)[SaxParseException exceptionWithName:@"SaxIOException"
- reason:@"can't handle data-source"
+ reason:@"cannot handle data-source"
userInfo:ui];
[self->errorHandler fatalError:e];
}
}
- (void)parseFromSource:(id)_source {
- [self parseFromSource:_source systemId:@"<memory>"];
+ if ([_source isKindOfClass:[NSString class]])
+ [self parseFromSource:_source systemId:@"<string>"];
+ else if ([_source isKindOfClass:[NSData class]])
+ [self parseFromSource:_source systemId:@"<data>"];
+ else if ([_source isKindOfClass:[NSURL class]])
+ [self parseFromSource:_source systemId:[_source absoluteString]];
+ else
+ [self parseFromSource:_source systemId:@"<memory>"];
}
- (void)parseFromSystemId:(NSString *)_sysId {
/* parsing */
+- (void)_handleEmptyDataInSystemId:(NSString *)_sysId {
+ /*
+ An empty HTML file _is_ valid?!
+ I guess it equals to <html><body></body></html>, wrong? => hh
+ */
+ [self->contentHandler startDocument];
+ [self->contentHandler startPrefixMapping:@"" uri:self->namespaceURI];
+
+ [self->contentHandler
+ startElement:@"html" namespace:XMLNS_XHTML
+ rawName:@"html" attributes:nil];
+ [self->contentHandler
+ startElement:@"body" namespace:XMLNS_XHTML
+ rawName:@"body" attributes:nil];
+
+ [self->contentHandler
+ endElement:@"body" namespace:XMLNS_XHTML rawName:@"body"];
+ [self->contentHandler
+ endElement:@"html" namespace:XMLNS_XHTML rawName:@"html"];
+
+ [self->contentHandler endPrefixMapping:@""];
+ [self->contentHandler endDocument];
+}
+
- (void)_parseFromData:(NSData *)_data systemId:(NSString *)_sysId {
NSAutoreleasePool *pool;
+
+ if ([_data length] == 0) {
+ [self _handleEmptyDataInSystemId:_sysId];
+ return;
+ }
pool = [[NSAutoreleasePool alloc] init];
if ([_source isKindOfClass:[NSData class]]) {
[self _parseFromData:_source systemId:_sysId];
+ return;
}
- else if ([_source isKindOfClass:[NSString class]]) {
+ if ([_source isKindOfClass:[NSString class]]) {
[self _parseFromData:[_source dataUsingEncoding:NSISOLatin1StringEncoding]
systemId:_sysId];
+ return;
}
- else {
+ if ([_source isKindOfClass:[NSURL class]]) {
+ NSData *data;
+
+ data = [_source isFileURL]
+ ? [NSData dataWithContentsOfMappedFile:[_source path]]
+ : [_source resourceDataUsingCache:YES];
+
+ [self _parseFromData:data systemId:[_source absoluteString]];
+ return;
+ }
+
+ {
SaxParseException *e;
NSDictionary *ui;
[pool release];
}
- (void)parseFromSource:(id)_source {
- [self parseFromSource:_source systemId:@"<memory>"];
+ if ([_source isKindOfClass:[NSString class]])
+ [self parseFromSource:_source systemId:@"<string>"];
+ else if ([_source isKindOfClass:[NSData class]])
+ [self parseFromSource:_source systemId:@"<data>"];
+ else if ([_source isKindOfClass:[NSURL class]])
+ [self parseFromSource:_source systemId:[_source absoluteString]];
+ else
+ [self parseFromSource:_source systemId:@"<memory>"];
}
- (void)parseFromSystemId:(NSString *)_sysId {