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<javax.xml.parsers.DocumentBuilder> createDocumentBuilders(int poolSize, boolean validating)
           
protected  ResourcePool<javax.xml.parsers.DocumentBuilder> getNonValidatingPool()
           
protected  ResourcePool<javax.xml.parsers.DocumentBuilder> getPool()
           
 java.util.List<Node> parseFragment(Configuration configuration, String fragment)
           Parses the document fragment contained in the given String object.
 Document parseTemplate(Configuration configuration, String documentName, java.io.Reader reader)
           Parses the document contained in the given Reader object.
protected static Document parseTemplateUsingPool(Configuration configuration, String documentName, java.io.Reader reader, ResourcePool<javax.xml.parsers.DocumentBuilder> pool)
           
protected abstract  java.util.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<javax.xml.parsers.DocumentBuilder> getPool()

getNonValidatingPool

protected final ResourcePool<javax.xml.parsers.DocumentBuilder> getNonValidatingPool()

createDocumentBuilders

protected final ResourcePool<javax.xml.parsers.DocumentBuilder> createDocumentBuilders(int poolSize,
                                                                                       boolean validating)

parseTemplate

public final Document parseTemplate(Configuration configuration,
                                    String documentName,
                                    java.io.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 static final Document parseTemplateUsingPool(Configuration configuration,
                                                       String documentName,
                                                       java.io.Reader reader,
                                                       ResourcePool<javax.xml.parsers.DocumentBuilder> pool)

parseFragment

public final java.util.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 java.util.List<Node> unwrapFragment(Document document)


Copyright © 2012 The THYMELEAF team. All Rights Reserved.