Skip to main content
Solved

XMLTemplater listattributes


Forum|alt.badge.img

Hi everyone, 

I don't know how to work with listattributes inside the XMLTemplater Transformer. 

A feature contains a list networks.network{}, foreach element in the list, I want to create a new child element "networkNode".

Do I have to loop threw the elements and create the xml for each, or is it possible to do it directly in the XMLTemplater? 

networks.network{0}.type = type0
networks.network{0}.linkage = linkage0
networks.network{1}.type = type1
networks.network{1}.linkage= linkage1

What I want my XML to look like: 

<OnlineContact>
  <aixm:networkNode>  
            <aixm:network>type0</aixm:network>
            <aixm:linkage>linkage0</aixm:linkage>
         </aixm:OnlineContact>
     </aixm:networkNode>
    <aixm:networkNode>  
            <aixm:network>type1</aixm:network>
            <aixm:linkage>linkage1</aixm:linkage>
         </aixm:OnlineContact>
     </aixm:networkNode>
</OnlineContact>

I am using FME Desktop 2015

Thanks, Mel

Best answer by kim

One possibility is to use a ListExploder on the list, then add them into the XmlTemplater using a Sub template.

I've included a sample that I believe achieves what you are trying to do in the workspace below:

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

Forum|alt.badge.img+5
  • Best Answer
  • March 4, 2016

One possibility is to use a ListExploder on the list, then add them into the XmlTemplater using a Sub template.

I've included a sample that I believe achieves what you are trying to do in the workspace below:


Forum|alt.badge.img
  • Author
  • March 4, 2016
kim wrote:

One possibility is to use a ListExploder on the list, then add them into the XmlTemplater using a Sub template.

I've included a sample that I believe achieves what you are trying to do in the workspace below:

Thanks, it does exactly what I want :)


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings