@Test public void just_HTML() { Resource resource = getResource("justHTML.tml"); ComponentTemplate template = getParser().parseTemplate(resource); assertSame(template.getResource(), resource); assertFalse(template.usesStrictMixinParameters()); List<TemplateToken> tokens = template.getTokens(); assertEquals(tokens.size(), 20); StartElementToken t0 = get(tokens, 0); assertEquals(t0.name, "html"); assertEquals(t0.namespaceURI, ""); checkLine(t0, 1); TextToken t1 = get(tokens, 1); assertEquals(t1.text, "\n "); StartElementToken t2 = get(tokens, 2); assertEquals(t2.name, "head"); checkLine(t2, 2); TextToken t5 = get(tokens, 5); assertEquals(t5.text, "title"); checkLine(t5, 3); get(tokens, 6); StartElementToken t12 = get(tokens, 12); assertEquals(t12.name, "p"); AttributeToken t13 = get(tokens, 13); assertEquals(t13.name, "class"); assertEquals(t13.value, "important"); assertEquals(t13.namespaceURI, ""); TextToken t14 = get(tokens, 14); assertEquals(t14.text.replaceAll("\\s+", " ").trim(), "Tapestry rocks! Line 2"); checkLine(t14, 6); }
public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } TemplateParserImpl(Map<String, URL> configuration,

                              @Symbol(SymbolConstants.COMPRESS_WHITESPACE)
                              boolean defaultCompressWhitespace, OperationTracker tracker); }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } TemplateParserImpl(Map<String, URL> configuration,

                              @Symbol(SymbolConstants.COMPRESS_WHITESPACE)
                              boolean defaultCompressWhitespace, OperationTracker tracker); ComponentTemplate parseTemplate(final Resource templateResource); Map<String, URL> getDTDURLMappings(); }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } TemplateParserImpl(Map<String, URL> configuration,

                              @Symbol(SymbolConstants.COMPRESS_WHITESPACE)
                              boolean defaultCompressWhitespace, OperationTracker tracker); ComponentTemplate parseTemplate(final Resource templateResource); Map<String, URL> getDTDURLMappings();  }