Package groovy.text.markup

## Class MarkupTemplateEngine

- java.lang.Object
- - groovy.text.TemplateEngine
  - - groovy.text.markup.MarkupTemplateEngine

-     public class MarkupTemplateEngine
      extends TemplateEngine

  A template engine which leverages `StreamingMarkupBuilder` to generate XML/XHTML.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `MarkupTemplateEngine.CachingTemplateResolver` | A template resolver which avoids calling `ClassLoader.getResource(String)` if a template path already has been queried before.
    `static class` | `MarkupTemplateEngine.DefaultTemplateResolver` |
    `static class` | `MarkupTemplateEngine.TemplateResource` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MarkupTemplateEngine()` |
    `MarkupTemplateEngine​(TemplateConfiguration tplConfig)` |
    `MarkupTemplateEngine​(ClassLoader parentLoader, TemplateConfiguration tplConfig)` |
    `MarkupTemplateEngine​(ClassLoader parentLoader, TemplateConfiguration tplConfig, TemplateResolver resolver)` |
    `MarkupTemplateEngine​(ClassLoader parentLoader, File templateDirectory, TemplateConfiguration tplConfig)` | Convenience constructor to build a template engine which searches for templates into a directory

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Template` | `createTemplate​(Reader reader)` | Creates a template by reading content from the Reader.
    `Template` | `createTemplate​(Reader reader, String sourceName)` |
    `Template` | `createTemplate​(URL resource)` | Creates a template from the content found at the URL using the default encoding.
    `Template` | `createTemplateByPath​(String templatePath)` |
    `Template` | `createTypeCheckedModelTemplate​(Reader reader, String sourceName, Map<String,​String> modelTypes)` |
    `Template` | `createTypeCheckedModelTemplate​(Reader reader, Map<String,​String> modelTypes)` |
    `Template` | `createTypeCheckedModelTemplate​(String source, String sourceName, Map<String,​String> modelTypes)` |
    `Template` | `createTypeCheckedModelTemplate​(String source, Map<String,​String> modelTypes)` |
    `Template` | `createTypeCheckedModelTemplate​(URL resource, Map<String,​String> modelTypes)` |
    `Template` | `createTypeCheckedModelTemplateByPath​(String templatePath, Map<String,​String> modelTypes)` |
    `CompilerConfiguration` | `getCompilerConfiguration()` |
    `TemplateConfiguration` | `getTemplateConfiguration()` |
    `GroovyClassLoader` | `getTemplateLoader()` |
    `URL` | `resolveTemplate​(String templatePath)` |

    - ### Methods inherited from class groovy.text.TemplateEngine

      `createTemplate, createTemplate, createTemplate, createTemplate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MarkupTemplateEngine

          public MarkupTemplateEngine()

    - #### MarkupTemplateEngine

          public MarkupTemplateEngine​(TemplateConfiguration tplConfig)

    - #### MarkupTemplateEngine

          public MarkupTemplateEngine​(ClassLoader parentLoader,
                                      TemplateConfiguration tplConfig)

    - #### MarkupTemplateEngine

          public MarkupTemplateEngine​(ClassLoader parentLoader,
                                      TemplateConfiguration tplConfig,
                                      TemplateResolver resolver)

    - #### MarkupTemplateEngine

          public MarkupTemplateEngine​(ClassLoader parentLoader,
                                      File templateDirectory,
                                      TemplateConfiguration tplConfig)

      Convenience constructor to build a template engine which searches for templates into a directory
      Parameters:
        `templateDirectory` - directory where to find templates
        `tplConfig` - template engine configuration

  - ### Method Detail

    - #### createTemplate

          public Template createTemplate​(Reader reader)
                                  throws CompilationFailedException,
                                         ClassNotFoundException,
                                         IOException

      Description copied from class: `TemplateEngine`
      Creates a template by reading content from the Reader.
      Specified by:
        `createTemplate` in class `TemplateEngine`
      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTemplate

          public Template createTemplate​(Reader reader,
                                         String sourceName)
                                  throws CompilationFailedException,
                                         ClassNotFoundException,
                                         IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTemplateByPath

          public Template createTemplateByPath​(String templatePath)
                                        throws CompilationFailedException,
                                               ClassNotFoundException,
                                               IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTypeCheckedModelTemplate

          public Template createTypeCheckedModelTemplate​(String source,
                                                         Map<String,​String> modelTypes)
                                                  throws CompilationFailedException,
                                                         ClassNotFoundException,
                                                         IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTypeCheckedModelTemplate

          public Template createTypeCheckedModelTemplate​(String source,
                                                         String sourceName,
                                                         Map<String,​String> modelTypes)
                                                  throws CompilationFailedException,
                                                         ClassNotFoundException,
                                                         IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTypeCheckedModelTemplate

          public Template createTypeCheckedModelTemplate​(Reader reader,
                                                         Map<String,​String> modelTypes)
                                                  throws CompilationFailedException,
                                                         ClassNotFoundException,
                                                         IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTypeCheckedModelTemplate

          public Template createTypeCheckedModelTemplate​(Reader reader,
                                                         String sourceName,
                                                         Map<String,​String> modelTypes)
                                                  throws CompilationFailedException,
                                                         ClassNotFoundException,
                                                         IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTypeCheckedModelTemplateByPath

          public Template createTypeCheckedModelTemplateByPath​(String templatePath,
                                                               Map<String,​String> modelTypes)
                                                        throws CompilationFailedException,
                                                               ClassNotFoundException,
                                                               IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTemplate

          public Template createTemplate​(URL resource)
                                  throws CompilationFailedException,
                                         ClassNotFoundException,
                                         IOException

      Description copied from class: `TemplateEngine`
      Creates a template from the content found at the URL using the default encoding. Please consider using `TemplateEngine.createTemplate(URL, Charset)`.
      Overrides:
        `createTemplate` in class `TemplateEngine`
      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### createTypeCheckedModelTemplate

          public Template createTypeCheckedModelTemplate​(URL resource,
                                                         Map<String,​String> modelTypes)
                                                  throws CompilationFailedException,
                                                         ClassNotFoundException,
                                                         IOException

      Throws:
        `CompilationFailedException`
        `ClassNotFoundException`
        `IOException`

    - #### getTemplateLoader

          public GroovyClassLoader getTemplateLoader()

    - #### getCompilerConfiguration

          public CompilerConfiguration getCompilerConfiguration()

    - #### getTemplateConfiguration

          public TemplateConfiguration getTemplateConfiguration()

    - #### resolveTemplate

          public URL resolveTemplate​(String templatePath)
                              throws IOException

      Throws:
        `IOException`