Updating of source XML file consist in :
To do that, you must :
<models> <model key="struts" type="xml" /> </models>
<output> <file key="struts" > <insert path="/struts/package/action[last()]" position="after" > <template uri="/ftl/struts2/struts.xml/action.ftl" /> </insert> </file> </output>
To set source XML file to update (which is defined into model), key attribute of the file element must refer key attribute of model element.
<action name="${actionName}" class="${actionClassName}"> <#if resultType != '' > <result type="${resultType}" /> </#if> </action>
Model definition type of xml and with xmlFileToUpdate is done like this :
... <models> <model type="xml" key="xmlFileToUpdate" /> ... </models> ...
file element is inside output element. It is able to describe th eupdating to do on source XML file which is defined into model. Updating source XML file with key xmlFileToUpdate :
... <output> <file key="xmlFileToUpdate" > ... </file> </output> ...
insert element is inside file element. It is able to insert XML fragment :
... <file key="xmlFileToUpdate" > <insert path="..." position="..." > <template uri="..." /> </insert> </file> ...
To set location of the XML fragment (which is generated with template), you must use attributes :