Skip to main content
Hi, 

 

 

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.
Hi,

 

I would check if the project tag exists in the root template. If that is the case try removing it.

 

Hope this helps.
I looked everywhere but the root template.  I was following an example from a tutorial and thought that the root XML needed to have references to the named sub-template ports using tags.  I know that these are refrences with {fme:process-features("")}.  The perils of cut-and-paste.

 

 

Thanks for pointing me the right direction.

Reply