Class NodeModel

java.lang.Object
freemarker.ext.dom.NodeModel
All Implemented Interfaces:
freemarker.core._UnexpectedTypeErrorExplainerTemplateModel, WrapperTemplateModel, AdapterTemplateModel, TemplateHashModel, TemplateModel, TemplateNodeModel, TemplateNodeModelEx, TemplateSequenceModel

public abstract class NodeModel extends Object implements TemplateNodeModelEx, TemplateHashModel, TemplateSequenceModel, AdapterTemplateModel, WrapperTemplateModel, freemarker.core._UnexpectedTypeErrorExplainerTemplateModel
A base class for wrapping a single W3C DOM Node as a FreeMarker template model.

Note that DefaultObjectWrapper automatically wraps W3C DOM Node-s into this, so you may need do that with this class manually. However, before dropping the Node-s into the data-model, you certainly want to apply simplify(Node) on them.

This class is not guaranteed to be thread safe, so instances of this shouldn't be used as shared variable ( Configuration.setSharedVariable(String, Object)).

To represent a node sequence (such as a query result) of exactly 1 nodes, this class should be used instead of NodeListModel, as it adds extra capabilities by utilizing that we have exactly 1 node. If you need to wrap a node sequence of 0 or multiple nodes, you must use NodeListModel.