SOPE supports various kinds of templates ... this document is about the internals of the NGObjWeb ones
TODO: write much more ...
How Templates Work ...
In general we have two kinds of templates, XML based ones and "hash" based ones. The 'hash' templates are simple scanners for strings which start and end with "<#" and "</#", while the XML based templates are valid and "namespace'd" XML files. Practical difference: - XML templates can be created, parsed, transformed, ... with any standard XML tool - hash templates can be used in a non-tag way, eg this is a valid template: <a href="<#MyHRef/>">blah</a> Since unlike the XML parser the hash parser only scans for "<#", this is OK. - hash templates use "wod" files for declarations which may or may not improve the visual clutter in the template itself - XML templates do not need to have a 1:1 mapping from tag to WODynamicElement and the mapping between tag and element is completely controlled by the builder while for hash templates you always use the actuall WODynamicElement subclass name in the .wod file
Abstract class to build NGObjWeb WOElement templates from XML DOM structures.
Template builders can be stacked in a processing queue, so that unknown elements are produced by the "nextBuilder". When processing is done using a stack, the first stack builder is called the "templateBuilder" and used to keep global state (eg the template builder must be used to create further elements if the same element set is required).
WOxElemBuilder stacks are not thread-safe since the template builder stores subcomponent creation info in an instance variable.
Component Discovery and Page Creation (WOResourceManager)
Component Discovery and Page Creation All WO code uses either directly or indirectly the WOResourceManager's -pageWithName:languages: method to instantiate WO components. This methods works in three steps: 1. discovery of files associated with the component 2. creation of a proper WOComponentDefinition, which is some kind of 'blueprint' or 'class' for components 3. component instantiation using the definition All the instantiation/setup work is done by a component definition, the resource manager is only responsible for managing those 'blueprint' resources. If you want to customize component creation, you can supply your own WOComponentDefinition in a subclass of WOResourceManager by overriding: - (WOComponentDefinition *)definitionForComponent:(id)_name inFramework:(NSString *)_frameworkName languages:(NSArray *)_languages