Skip to main content
Solved

Call Transformer within TCL shutdownscript

  • July 21, 2015
  • 1 reply
  • 10 views

Forum|alt.badge.img
Hi everybody,

 

 

I wrote a shutdown script for logging, now I want to call a XMLFormatter at the end of this tcl script to linearize my output. Is this possible and how?

 

I guess the XMLFormatter would need the Parameters:Formatting Type, XML Input and Output File

 

 

Other question, how can I run an other workspace within tcl, so that it also works with the FME Server?

 

 

Background:

 

I write a xml file with the aixm writer and want the output (xml file) to be linearized. Therefor I want to use the XMLFormatter.

 

 

Thank you,

 

Mel

Best answer by takashi

Hi Mel,

 

 

As far as I know, there is no way to use any transformer in the shutdown script.

 

 

Just an idea.

 

As a workaround, this shutdown Tcl script might work to linearize an XML file. Assume that "XmlFilePath" parameter value indicates the existing XML file path.

 

-----

 

if {$FME_Status == 1} {

 

    set file [open $FME_MacroValues(XmlFilePath) r]

 

    set text [read $file]

 

    close $file

 

    set text [regsub -all {>\\s+} $text {>}]

 

    set text [regsub -all {\\s+<} $text {<}]

 

    set file [open $FME_MacroValues(XmlFilePath) w]

 

    puts -nonewline $file $text

 

    close $file

 

}

 

-----

 

 

Takashi
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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.

1 reply

takashi
Celebrity
  • Best Answer
  • July 21, 2015
Hi Mel,

 

 

As far as I know, there is no way to use any transformer in the shutdown script.

 

 

Just an idea.

 

As a workaround, this shutdown Tcl script might work to linearize an XML file. Assume that "XmlFilePath" parameter value indicates the existing XML file path.

 

-----

 

if {$FME_Status == 1} {

 

    set file [open $FME_MacroValues(XmlFilePath) r]

 

    set text [read $file]

 

    close $file

 

    set text [regsub -all {>\\s+} $text {>}]

 

    set text [regsub -all {\\s+<} $text {<}]

 

    set file [open $FME_MacroValues(XmlFilePath) w]

 

    puts -nonewline $file $text

 

    close $file

 

}

 

-----

 

 

Takashi