Java Doc for FreemarkerXmlTask.java in  » Template-Engine » freemarker-2.3.10 » freemarker » ext » ant » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » freemarker 2.3.10 » freemarker.ext.ant 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


freemarker.ext.ant.FreemarkerXmlTask

FreemarkerXmlTask
public class FreemarkerXmlTask extends MatchingTask (Code)

This is an Ant task for transforming XML documents using FreeMarker templates. It uses the adapter class NodeListModel . It will read a set of XML documents, and pass them to the template for processing, building the corresponding output files in the destination directory.

It makes the following variables available to the template in the data model:

  • document: Deprecated! The DOM tree of the currently processed XML file wrapped with the legacy freemarker.ext.xml.NodeListModel . For new projects you should use the .node instead, which initially contains the DOM Document wrapped with freemarker.ext.dom.NodeModel .
  • properties: a freemarker.template.SimpleHash containing properties of the project that executes the task
  • userProperties: a freemarker.template.SimpleHash containing user properties of the project that executes the task
  • project: the DOM tree of the XML file specified by the projectfile. It will not be available if you didn't specify the projectfile attribute.
  • further custom models can be instantiated and made available to the templates using the models attribute.

It supports the following attributes:

Attribute Description Required
basedir location of the XML files. Defaults to the project's basedir. No
destdir location to store the generated files. Yes
includes comma-separated list of patterns of files that must be included; all files are included when omitted. No
includesfile the name of a file that contains include patterns. No
excludes comma-separated list of patterns of files that must be excluded; no files (except default excludes) are excluded when omitted. No
excludesfile the name of a file that contains exclude patterns. No
defaultexcludes indicates whether default excludes should be used (yes | no); default excludes are used when omitted. No
extension extension of generated files. Defaults to .html. No
template name of the FreeMarker template file that will be applied by default to XML files No
templateDir location of the FreeMarker template(s) to be used, defaults to the project's baseDir No
projectfile path to the project file. The poject file must be an XML file. If omitted, it will not be available to templates No
incremental indicates whether all files should be regenerated (no), or only those that are older than the XML file, the template file, or the project file (yes). Defaults to yes. No
encoding The encoding of the output files. Defaults to platform default encoding. No
templateEncoding The encoding of the template files. Defaults to platform default encoding. No
validation Whether to validate the XML input. Defaults to off. No
models A list of [name=]className pairs separated by spaces, commas, or semicolons that specifies further models that should be available to templates. If name is omitted, the unqualified class name is used as the name. Every class that is specified must implement the TemplateModel interface and have a no-args constructor. No

It supports the following nesed elements:

Element Description Required
prepareModel This element executes Jython script before the processing of each XML files, that you can use to modify the data model. You either enter the Jython script directly nested into this element, or specify a Jython script file with the file attribute. The following variables are added to the Jython runtime's local namespace before the script is invoked:
  • model: The data model as java.util.HashMap. You can read and modify the data model with this variable.
  • doc: The XML document as org.w3c.dom.Document.
  • project: The project document (if used) as org.w3c.dom.Document.
If this element is used, Jython classes (tried with Jython 2.1) must be available.
No
prepareEnvironment This element executes Jython script before the processing of each XML files, that you can use to modify the freemarker environment ( freemarker.core.Environment ). The script is executed after the prepareModel element. The accessible Jython variables are the same as with the prepareModel element, except that there is no model variable, but there is env variable, which is the FreeMarker environment ( freemarker.core.Environment ). If this element is used, Jython classes (tried with Jython 2.1) must be available. No

author:
   Attila Szegedi
author:
   Jonathan Revusky, jon@revusky.com
version:
   $Id: FreemarkerXmlTask.java,v 1.58.2.1 2006/04/26 11:07:58 revusky Exp $



Constructor Summary
public  FreemarkerXmlTask()
     Constructor creates the SAXBuilder.

Method Summary
public  voidaddConfiguredJython(JythonAntTask jythonAntTask)
    
public  voidaddConfiguredPrepareEnvironment(JythonAntTask prepareEnvironment)
    
public  voidaddConfiguredPrepareModel(JythonAntTask prepareModel)
    
public  voidexecute()
    
protected  voidinsertDefaults(Map root)
    
public  voidsetBasedir(File dir)
     Set the base directory.
public  voidsetDestdir(File dir)
    
public  voidsetEncoding(String encoding)
     Set encoding for generated files.
public  voidsetExtension(String extension)
     Set the output file extension.
public  voidsetIncremental(String incremental)
     Turn on/off incremental processing.
public  voidsetModels(String models)
    
public  voidsetProjectfile(String projectAttribute)
    
public  voidsetTemplate(String templateName)
    
public  voidsetTemplateDir(File templateDir)
    
public  voidsetTemplateEncoding(String inputEncoding)
    
public  voidsetValidation(boolean validation)
     Sets whether to validate the XML input.


Constructor Detail
FreemarkerXmlTask
public FreemarkerXmlTask()(Code)
Constructor creates the SAXBuilder.




Method Detail
addConfiguredJython
public void addConfiguredJython(JythonAntTask jythonAntTask)(Code)



addConfiguredPrepareEnvironment
public void addConfiguredPrepareEnvironment(JythonAntTask prepareEnvironment)(Code)



addConfiguredPrepareModel
public void addConfiguredPrepareModel(JythonAntTask prepareModel)(Code)



execute
public void execute() throws BuildException(Code)



insertDefaults
protected void insertDefaults(Map root)(Code)



setBasedir
public void setBasedir(File dir)(Code)
Set the base directory. Defaults to .



setDestdir
public void setDestdir(File dir)(Code)
Set the destination directory into which the generated files should be copied to
Parameters:
  dir - the name of the destination directory



setEncoding
public void setEncoding(String encoding)(Code)
Set encoding for generated files. Defaults to platform default encoding.



setExtension
public void setExtension(String extension)(Code)
Set the output file extension. .html by default.



setIncremental
public void setIncremental(String incremental)(Code)
Turn on/off incremental processing. On by default



setModels
public void setModels(String models)(Code)



setProjectfile
public void setProjectfile(String projectAttribute)(Code)
Set the path to the project XML file



setTemplate
public void setTemplate(String templateName)(Code)



setTemplateDir
public void setTemplateDir(File templateDir) throws BuildException(Code)



setTemplateEncoding
public void setTemplateEncoding(String inputEncoding)(Code)



setValidation
public void setValidation(boolean validation)(Code)
Sets whether to validate the XML input.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.