C# Class NVelocity.Template

This class is used for controlling all template operations. This class uses a parser created by JavaCC to create an AST that is subsequently traversed by a Visitor. Template template = Velocity.getTemplate("test.wm"); IContext context = new VelocityContext(); context.Put("foo", "bar"); context.Put("customer", new Customer()); template.Merge(context, writer);
Inheritance: NVelocity.Runtime.Resource.Resource
Afficher le fichier Open project: rasmus-toftdahl-olesen/NVelocity Class Usage Examples

Méthodes publiques

Méthode Description
InitDocument ( ) : void

initializes the document. init() is not longer dependant upon context, but we need to let the init() carry the template name down through for VM namespace features

Merge ( IContext context, TextWriter writer ) : void

The AST node structure is merged with the context to produce the final output. Throws IOException if failure is due to a file related issue, and Exception otherwise

Process ( ) : bool

Gets the named resource as a stream, parses and inits.

Méthodes protégées

Méthode Description
ObtainStream ( ) : Stream

Method Details

InitDocument() public méthode

initializes the document. init() is not longer dependant upon context, but we need to let the init() carry the template name down through for VM namespace features
public InitDocument ( ) : void
Résultat void

Merge() public méthode

The AST node structure is merged with the context to produce the final output. Throws IOException if failure is due to a file related issue, and Exception otherwise
/// if template not found from any available source. /// /// if template cannot be parsed due to syntax (or other) error. /// /// anything else. ///
public Merge ( IContext context, TextWriter writer ) : void
context IContext Context with data elements accessed by template
writer System.IO.TextWriter writer for rendered template
Résultat void

ObtainStream() protected méthode

protected ObtainStream ( ) : Stream
Résultat Stream

Process() public méthode

Gets the named resource as a stream, parses and inits.
/// if template not found from any available source. /// /// if template cannot be parsed due to syntax (or other) error. /// /// some other problem, should only be from initialization of the template AST. ///
public Process ( ) : bool
Résultat bool