Package fmpp

Class 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 set copy to true. All other options are optional.

    • Constructor Detail

      • XmlRenderingConfiguration

        public XmlRenderingConfiguration()
        Creates new object.
    • 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 be null.
      • 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 is true, then the value of the template 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 be null 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.
      • 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.

      • 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 which false 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 class java.lang.Object