Question

building a heirachical xml file from a flat list


I have a list of code numbers and descriptions. i wish top converted them into an xml file that has parent child relationship. Can any suggest tutorial or content that is appropriate? Thanks B

here is a screen shot of my list

and here is what i need


6 replies

Userlevel 2
Badge +17

Hi @brendenroche, it seems that the XMLTemplater can perform recursively sub template expression to create such a hierarchical structured XML. See the attached example.

perform-xml-template-recursively.fmwt (FME 2018.1.1.2)

Badge +2

@brendenroche The tutorial XML Writing with XMLTemplater might be what you were looking for. Exercise 1b

Hi @Takashi, sorry for the very long delay in thanking you for you answer. Unfortunatley I only have access to FME 2015.1 so when i open your example I am missing some steps. Do you have any suggestions for the missing pieces?

Could you perhaps list the steps needed .

Thank you once again.

Userlevel 2
Badge +17

Hi @Takashi, sorry for the very long delay in thanking you for you answer. Unfortunatley I only have access to FME 2015.1 so when i open your example I am missing some steps. Do you have any suggestions for the missing pieces?

Could you perhaps list the steps needed .

Thank you once again.

Fortunately I still have FME 2015.1 installation.

perform-xml-template-recursively-fme-2015.fmwt (FME 2015.1.3.2)

Hi @takashi thank you for that.

 

I have had a quick look and play with your example. This is really helpful thankyou. I note that the output from the xml formatter does not look correct I have "20" (1+2+17) inputs but only 1 output. I added some loggers and inspectors to try and see whats happening. I have tried changing the attribute output to text_line_data as per the tutorials. As far as i can understand whats happening , it seems the 2 "sub " routines are not being included in the output from the formatter only the root statement

Tester_logger looks OK

B

Badge +2

Hi @takashi thank you for that.

 

I have had a quick look and play with your example. This is really helpful thankyou. I note that the output from the xml formatter does not look correct I have "20" (1+2+17) inputs but only 1 output. I added some loggers and inspectors to try and see whats happening. I have tried changing the attribute output to text_line_data as per the tutorials. As far as i can understand whats happening , it seems the 2 "sub " routines are not being included in the output from the formatter only the root statement

Tester_logger looks OK

B

@brendenroche The single output feature does seem odd, but it is correct. The XMLTemplater takes all of your inputs and merges them into a single attribute ("_result") that contains the XML document. You then would use the Text File writer to write that out. You have to open the attribute in the attribute value viewer to see the complete result in FME Data Inspector.

Reply