Skip to main content
Solved

Call Transformer within TCL shutdownscript

  • July 21, 2015
  • 1 reply
  • 6 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
View original
Did this help you find an answer to your question?
<strong>This post is closed to further activity.</strong><br /> It may be a question with a best answer, an implemented idea, or just a post needing no comment.<br /> If you have a follow-up or related question, please <a href="https://community.safe.com/topic/new">post a new question or idea</a>.<br /> If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

takashi
Influencer
  • 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

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