|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.template.TemplateProcessor
org.formaria.template.XmlTemplateProcessor
public class XmlTemplateProcessor
A template processor for parameterized XML files.
Individual elements can be excludes/included in the copy of the template file by adding the 'te_include' attribute to those elements. The attribute value is then used to query the template engine's includes method. The method's return value dictates whether or not the element is included.
A <Repeat> element can be included so that elements can be
repeated. The element is repeated while the while attribute
evaluates to true. The same evaluation mechansim as is used
within Aria's page is employed and the TemplateEngine's
subclasses can implement the callback methods. As each item is included the
loop counter is processed and this value can be used with expressoions as the
value {N}. Each attribute is evaluated so that the necessary
substitutions can be made. This a field name by be coded as
name="addressEdit{N}" such that the name is different for each
element included.
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from formaria.
$Revision: 1.6 $
| Field Summary |
|---|
| Fields inherited from class org.formaria.template.TemplateProcessor |
|---|
APPLY_RESOURCE, COPY_FILE, currentProject, engine, PROCESSING_INSTRUCTION, RENAME_ELEMENT, RENAME_FILE, sourceFile, sourceFileName, targetFile, targetFileName |
| Constructor Summary | |
|---|---|
XmlTemplateProcessor(Project proj,
TemplateEngine te)
|
|
| Method Summary | |
|---|---|
protected boolean |
copyResources(XmlElement xe)
Attempt to copy the resources specified in XML template |
protected boolean |
excludeElements(XmlElement xe)
Exclude those elements that are marked as being optional. |
protected boolean |
includeElements(XmlElement xe)
Include the xml fragements referenced by the include elements |
protected boolean |
insertAttribute(XmlElement xe)
Sustitute any content, field values etc described in the template |
protected boolean |
loadFile()
Read the XML template |
boolean |
process(java.lang.String sourceName,
java.lang.String targetName,
int processingType)
|
protected boolean |
repeatElements(XmlElement parent,
XmlElement xe)
Repeat those elements that are within a repeat element. |
protected boolean |
saveFile()
Save the XML template |
| Methods inherited from class org.formaria.template.TemplateProcessor |
|---|
copyFile |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlTemplateProcessor(Project proj,
TemplateEngine te)
| Method Detail |
|---|
public boolean process(java.lang.String sourceName,
java.lang.String targetName,
int processingType)
process in class TemplateProcessorprotected boolean loadFile()
protected boolean saveFile()
protected boolean includeElements(XmlElement xe)
xe - the element being processed
protected boolean excludeElements(XmlElement xe)
xe - the element being processed
protected boolean repeatElements(XmlElement parent,
XmlElement xe)
parent - the parent of the element being processedxe - the element being processed
protected boolean insertAttribute(XmlElement xe)
xe - the element being processed
protected boolean copyResources(XmlElement xe)
xe - the element being processed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||