org.thymeleaf.templateparser.xmldom
Class AbstractNonValidatingDOMTemplateParser

Object
  extended by org.thymeleaf.templateparser.xmldom.AbstractNonValidatingDOMTemplateParser
All Implemented Interfaces:
ITemplateParser
Direct Known Subclasses:
AbstractValidatingDOMTemplateParser, XhtmlAndHtml5NonValidatingDOMTemplateParser, XmlNonValidatingDOMTemplateParser

public abstract class AbstractNonValidatingDOMTemplateParser
extends Object
implements ITemplateParser

Parses XML documents, using a standard non-validating DOM parser.

This implementation first builds a DOM tree using the standard DOM API, and then translates this tree into a Thymeleaf-specific one. It also populates tree nodes with basic location information (document name only).

Since:
2.0.0
Author:
Daniel Fernández

Constructor Summary
protected AbstractNonValidatingDOMTemplateParser(int poolSize)
           
 
Method Summary
protected  ResourcePool<DocumentBuilder> createDocumentBuilders(int poolSize, boolean validating)
           
protected  ResourcePool<DocumentBuilder> getNonValidatingPool()
           
protected  ResourcePool<DocumentBuilder> getPool()
           
protected  TemplatePreprocessingReader getTemplatePreprocessingReader(Reader reader)
           
 List<Node> parseFragment(Configuration configuration, String fragment)
           Parses the document fragment contained in the given String object.
 Document parseTemplate(Configuration configuration, String documentName, Reader reader)
           Parses the document contained in the given Reader object.
protected  Document parseTemplateUsingPool(Configuration configuration, String documentName, Reader reader, ResourcePool<DocumentBuilder> poolToBeUsed)
           
protected  boolean shouldAddThymeleafRootToParser()
           
protected abstract  List<Node> unwrapFragment(Document document)
           
protected abstract  String wrapFragment(String fragment)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNonValidatingDOMTemplateParser

protected AbstractNonValidatingDOMTemplateParser(int poolSize)
Method Detail

getPool

protected ResourcePool<DocumentBuilder> getPool()

getNonValidatingPool

protected final ResourcePool<DocumentBuilder> getNonValidatingPool()

createDocumentBuilders

protected final ResourcePool<DocumentBuilder> createDocumentBuilders(int poolSize,
                                                                     boolean validating)

parseTemplate

public final Document parseTemplate(Configuration configuration,
                                    String documentName,
                                    Reader reader)
Description copied from interface: ITemplateParser

Parses the document contained in the given Reader object.

Specified by:
parseTemplate in interface ITemplateParser
Parameters:
configuration - the Configuration object
documentName - the document name (optional).
reader - the Reader on the document to be parsed (required).
Returns:
the parsed Document.

parseTemplateUsingPool

protected final Document parseTemplateUsingPool(Configuration configuration,
                                                String documentName,
                                                Reader reader,
                                                ResourcePool<DocumentBuilder> poolToBeUsed)

parseFragment

public final List<Node> parseFragment(Configuration configuration,
                                      String fragment)
Description copied from interface: ITemplateParser

Parses the document fragment contained in the given String object.

Specified by:
parseFragment in interface ITemplateParser
Parameters:
configuration - the Configuration object
fragment - the String containing the fragment
Returns:
the resulting list of nodes.

wrapFragment

protected abstract String wrapFragment(String fragment)

unwrapFragment

protected abstract List<Node> unwrapFragment(Document document)

shouldAddThymeleafRootToParser

protected boolean shouldAddThymeleafRootToParser()
Since:
2.0.11

getTemplatePreprocessingReader

protected TemplatePreprocessingReader getTemplatePreprocessingReader(Reader reader)
Since:
2.0.11


Copyright © 2013 The THYMELEAF team. All Rights Reserved.