fmpp.dataloaders
Class XmlDataLoader

java.lang.Object
  extended by fmpp.dataloaders.XmlDataLoader
All Implemented Interfaces:
DataLoader

public class XmlDataLoader
extends java.lang.Object
implements DataLoader

Returns a variable that exposes the content of an XML file.


Field Summary
static java.lang.String OPTION_INDEX
           
static java.lang.String OPTION_NAMESPACE_AWARE
           
static java.lang.String OPTION_REMOVE_COMMENTS
           
static java.lang.String OPTION_REMOVE_PIS
           
static java.lang.String OPTION_VALIDATE
           
static java.lang.String OPTION_XMLNS
           
 
Constructor Summary
XmlDataLoader()
           
 
Method Summary
static boolean isOptionName(java.lang.String optionName)
          Checks if the string is a valid xml data loader option name.
 java.lang.Object load(Engine engine, java.util.List args)
           
 freemarker.template.TemplateNodeModel load(Engine engine, java.util.List args, org.w3c.dom.Document preLoadedDoc)
           
static org.w3c.dom.Document loadXmlFile(Engine engine, java.io.File xmlFile, boolean namespaceAware, boolean validate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_REMOVE_COMMENTS

public static final java.lang.String OPTION_REMOVE_COMMENTS
See Also:
Constant Field Values

OPTION_REMOVE_PIS

public static final java.lang.String OPTION_REMOVE_PIS
See Also:
Constant Field Values

OPTION_NAMESPACE_AWARE

public static final java.lang.String OPTION_NAMESPACE_AWARE
See Also:
Constant Field Values

OPTION_VALIDATE

public static final java.lang.String OPTION_VALIDATE
See Also:
Constant Field Values

OPTION_INDEX

public static final java.lang.String OPTION_INDEX
See Also:
Constant Field Values

OPTION_XMLNS

public static final java.lang.String OPTION_XMLNS
See Also:
Constant Field Values
Constructor Detail

XmlDataLoader

public XmlDataLoader()
Method Detail

load

public java.lang.Object load(Engine engine,
                             java.util.List args)
                      throws java.lang.Exception
Specified by:
load in interface DataLoader
args - Arguments that the caller specifies for this directive call. Not null. The implementation should check if it understands all arguments, and it should throw java.lang.IllegalArgumentException if it doesn't.
Returns:
The object that will be accessed in FreeMarker templates. The object can be of any type. FreeMarker will wrap the object so that it is visible as an FTL variable. However, if the object implements freemarker.template.TemplateModel, then it will not be wrapped, as it is already an FTL variable.
Throws:
java.lang.Exception

load

public freemarker.template.TemplateNodeModel load(Engine engine,
                                                  java.util.List args,
                                                  org.w3c.dom.Document preLoadedDoc)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

isOptionName

public static boolean isOptionName(java.lang.String optionName)
Checks if the string is a valid xml data loader option name. Options names are the keys in the hash pased as the 2nd argument to the xml data loader.


loadXmlFile

public static org.w3c.dom.Document loadXmlFile(Engine engine,
                                               java.io.File xmlFile,
                                               boolean namespaceAware,
                                               boolean validate)
                                        throws org.xml.sax.SAXException,
                                               java.io.IOException,
                                               javax.xml.parsers.ParserConfigurationException
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException