I am successfully using the XMLTemplater/XMLFormater approach to write to a TEXTLINE writer. My question is about adding attributes to the top level "port". A configuration like this (PROJECT) reads in template files based on user parameters:
Using a template like this:
<Project name="{fme:get-attribute("fs_project_name")}" type="Asset">
<AssignedTo>"{fme:get-attribute("fs_assigned_to")}</AssignedTo>
<ScheduleDate>{fme:get-attribute("fs_schedule_date")}</ScheduleDate>
<DueDate>{fme:get-attribute("fs_due_date")}</DueDate>
<ComplianceDate>{fme:get-attribute("fs_compliance_date")}</ComplianceDate>
<UploadStatus>InBasket</UploadStatus>
<Location>
<Geometry type="undefined"/>
<OriginalGeometry type="undefined"/>
</Location>
<Attributes>
<Attribute id = "InspectionType">Asset</Attribute>
</Attributes>
</Project>
Results in this (You can see that the <Project> tag is repeated.
<Project>
<Project name="T00123456" type="Asset">
<AssignedTo>"204052230</AssignedTo>
<ScheduleDate>2015-07-08</ScheduleDate>
<DueDate>2015-07-08</DueDate>
<ComplianceDate>2015-07-08</ComplianceDate>
<UploadStatus>InBasket</UploadStatus>
<Location>
<Geometry type="undefined"></Geometry>
<OriginalGeometry type="undefined"></OriginalGeometry>
</Location>
<Attributes>
<Attribute id="InspectionType">Asset</Attribute>
</Attributes>
</Project>
</Project>
My work-around is to use a couple of StringReplacers to remove the superfluous tags but I was wondering if there is a more elegant way.
Thanks in advance.