|
Docmosis API 4.5.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.docmosis.template.analysis.structure.SimpleJSONTemplateStructureProcessor
This class can process a template structure and then output the template information in an JSON format. This allows automated processes to use the Docmosis template to drive various things including building input web-forms or sample/data processes. After the processor has been used by the TemplateStructureExtractor, call the toString() function to get the JSON structure. For example:
TemplateIdentifier templateId = new TemplateIdentifier("myTemplate1.doc"); SimpleJSONTemplateStructureProcessor jsonProcessor = new SimpleJSONTemplateStructureProcessor(); TemplateStructureExtractor.process(jsonProcessor, templateId); System.out.println(jsonProcessor.toString());This class is not aware of some of the more complex elements available in templates:
variables (eg $top)
Constructor Summary | |
SimpleJSONTemplateStructureProcessor()
|
|
SimpleJSONTemplateStructureProcessor(String mainKeyName)
Create a new processor which creates a JSON object with one element using the mainKeyName name. |
Method Summary | |
void |
conditionalBegin(TemplateStructureElement e)
Process the start of a conditional section |
void |
conditionalEnd(TemplateStructureElement e)
Process the end of a conditional section |
void |
field(TemplateStructureElement e)
Process a template field. |
void |
finish()
Perform processing for the end of the template structure. |
void |
image(TemplateStructureElement e)
Process a template image |
boolean |
repeatBegin(TemplateStructureElement e,
int iterationIdx)
Process the start of a repeating section. |
boolean |
repeatEnd(TemplateStructureElement e,
int iterationIdx)
Process the end of a repeating section |
void |
setDataReferenceCollector(DataReferenceCollector dataReferenceCollector)
|
void |
start()
Perform processing for the beginning of the template structure. |
void |
templateReference(TemplateStructureElement e)
Process a reference to another template |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SimpleJSONTemplateStructureProcessor()
public SimpleJSONTemplateStructureProcessor(String mainKeyName)
mainKeyName
- if null, the structure returned (by toString())
will be a JSON array instead of a JSON Object containing
the array.Method Detail |
public void start()
TemplateStructureProcessor
start
in interface TemplateStructureProcessor
public void finish()
TemplateStructureProcessor
finish
in interface TemplateStructureProcessor
public void field(TemplateStructureElement e)
TemplateStructureProcessor
field
in interface TemplateStructureProcessor
e
- the field detailspublic void image(TemplateStructureElement e)
TemplateStructureProcessor
image
in interface TemplateStructureProcessor
e
- the image detailspublic void templateReference(TemplateStructureElement e)
TemplateStructureProcessor
templateReference
in interface TemplateStructureProcessor
e
- the template reference detailspublic boolean repeatBegin(TemplateStructureElement e, int iterationIdx)
TemplateStructureProcessor
repeatBegin
in interface TemplateStructureProcessor
e
- the section detailsiterationIdx
- the index of the iteration of this repeating section
starting at zero
public boolean repeatEnd(TemplateStructureElement e, int iterationIdx)
TemplateStructureProcessor
repeatEnd
in interface TemplateStructureProcessor
e
- the section detailsiterationIdx
- the index of the iteration of this repeating section
starting at zero
public void conditionalBegin(TemplateStructureElement e)
TemplateStructureProcessor
conditionalBegin
in interface TemplateStructureProcessor
e
- the section detailspublic void conditionalEnd(TemplateStructureElement e)
TemplateStructureProcessor
conditionalEnd
in interface TemplateStructureProcessor
e
- the section detailspublic String toString()
public void setDataReferenceCollector(DataReferenceCollector dataReferenceCollector)
|
Docmosis API 4.5.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |