Package fmpp
Class XmlRenderingConfiguration
- java.lang.Object
-
- fmpp.XmlRenderingConfiguration
-
public class XmlRenderingConfiguration extends java.lang.Object
Stores options that describe when and how to process an XML file in "renderXml" processing mode.Do not change this object after you have added it to the
Engine
. It's in principle an immutable object, but to prevent too many constructor parameters and later backward compatibility problems, you have to specify the options with setter methods, rather than with constructor arguments.You must set a non-
null
template
or setcopy
totrue
. All other options are optional.
-
-
Constructor Summary
Constructors Constructor Description XmlRenderingConfiguration()
Creates new object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDocumentElement(java.lang.String xmlns, java.lang.String localName)
Adds an element to the list of document elements.void
addLocalDataBuilder(LocalDataBuilder localDataBuilder)
Adds an extra local data builder that is invoked after all other local data builders.void
addSourcePathPattern(java.lang.String pathPattern)
Adds a path to the list of source path patterns.void
addXmlDataLoaderOption(java.lang.String name, java.lang.Object value)
Adds or replaces an option in the map of xml data loader options.void
clearDocumentElements()
Empties the document element list.void
clearLocalDataBuilders()
Removes all local data builders.void
clearSourcePathPatterns()
Empties the list of source path patterns.void
clearXmlDataLoaderOptions()
Removes all xml data loader options.void
setCopy(boolean copy)
Sets if the XML file should be copied as is, or renderd with a template.void
setTemplate(java.lang.String template)
Sets the renderer template.java.lang.String
toString()
-
-
-
Method Detail
-
setTemplate
public void setTemplate(java.lang.String template)
Sets the renderer template.- Parameters:
template
- the source path of the template used for the rendering of the XML file. Can't benull
.
-
setCopy
public void setCopy(boolean copy)
Sets if the XML file should be copied as is, or renderd with a template. If the value of this option istrue
, then the value of thetemplate
option is insignificant.
-
addDocumentElement
public void addDocumentElement(java.lang.String xmlns, java.lang.String localName)
Adds an element to the list of document elements. The XML file will not be processed according this configuration object if this list doesn't contain the document element of the XML file. If the list is empty, then this criteria will not be considered (accepts XML documents regardels of their document element).- Parameters:
xmlns
- the name-space URL of the element. This should benull
or 0-length stirng if the element doesn't belong to any XML name-space.localName
- the local (name-space preixless) name of the element.
-
clearDocumentElements
public void clearDocumentElements()
Empties the document element list.- See Also:
addDocumentElement(String, String)
-
addLocalDataBuilder
public void addLocalDataBuilder(LocalDataBuilder localDataBuilder)
Adds an extra local data builder that is invoked after all other local data builders. The task of this builder is to do the complex or resource eager parts of the XML processing that you don't want to do in FTL, and expose the results as local data.The data loaders added earlier will be executed earlier. The data loader executed later can replace earlier added local data variables.
-
clearLocalDataBuilders
public void clearLocalDataBuilders()
Removes all local data builders.- See Also:
addLocalDataBuilder(LocalDataBuilder)
-
addSourcePathPattern
public void addSourcePathPattern(java.lang.String pathPattern)
Adds a path to the list of source path patterns. The XML file will not be processed according this configuration object if no path in this list matches the source root relative path of the XML file. If the list is empty, then this criteria will not be considered (accepts XML documents regardels of their source file path).- Parameters:
pathPattern
- the path pattern of the source root relative path of the XML file. It doesn't mater if it starts with / or not.
-
clearSourcePathPatterns
public void clearSourcePathPatterns()
Empties the list of source path patterns.- See Also:
addSourcePathPattern(String)
-
addXmlDataLoaderOption
public void addXmlDataLoaderOption(java.lang.String name, java.lang.Object value)
Adds or replaces an option in the map of xml data loader options. The set of valid values are specified by the xml data loader (see in the FMPP Manual), and they will not be validated until the data loader is actually invoked, so when the processing of the XML file starts. The only exception from this rule is the"namespaceAware"
option, for whichfalse
value is not allowed.- Parameters:
name
- the name of the option. Option"namespaceAware"
is not allowed.value
- the value of the option
-
clearXmlDataLoaderOptions
public void clearXmlDataLoaderOptions()
Removes all xml data loader options.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-