Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In one folder I can have one or more xml files. I would like (need) to use them one by one as input dataset (reader). Actually each xml file will be used within according fme workbench regardless some values within xml file. This question is linked with my old question Variable XML dataset as reader in FME wher I got answer for one file in folder.

If I have two xml files, for instance, fme read them both at the "same time" and use values from both files for one fme wb.

share|improve this question
    
I solved this with python indirectly, but sill wondering if this is possible with fme. Tnx. –  Z77 Jul 24 '12 at 13:19
    
What version of FME are you using? (including build number) - currently FME Desktop SP3 (Build 12258) –  Mapperz Jul 24 '12 at 13:27
    
FME Desktop 2011 Build 6508 –  Z77 Jul 24 '12 at 13:58
2  
I would firstly recommend upgrading your FME Desktop there are many functions for XML and big improvements on existing Transformers using XML - 8 Ways We Improved FME to Handle XML (with videos) blog.safe.com/2012/02/loving-xml-with-fme-2012 –  Mapperz Jul 24 '12 at 16:42

1 Answer 1

up vote 4 down vote accepted

I would second @Mapperz comment about upgrading - FME 2012 SP2 contains some significant improvements. If you have a current active maintenance contract then you can download the latest version direct from Safe Software.

As is always the case there are several different ways you can achieve the right result using FME. Here are two approaches you could consider:

Approach 1: MS-DOS Batch Script

When you run a workspace from within FME Workbench what you are actually doing is executing the command-line fme executable. Armed with this knowledge it is straight forward to execute a workspace from the command-line, in fact FME Workbench makes it even easier for you as the top of the log in the log viewer panel will display the command-line to use if you want to execute the workspace from a DOS prompt.

Using that information you can create a batch file to scan a directory of files and then send them one-by-one to FME for processing. For example:

SET FME="C:\Program Files\FME\fme.exe"
SET SOURCE_DATA_DIR="D:\Temp"
SET FME_WORKBENCH="YourWorkspace.fmw"
REM Set any other options here

FOR %%A IN (%SOURCE_DATA_DIR%\*.xml) DO (%FME% %FME_WORKBENCH% --SOURCE_FILE %%A)

Obviously you will need to adpat this to your needs but use the output from running your workspace in FME Workbench as a guide.

Approach 2: Controller Workspace

An alternative approach is to use a controller workspace to execute another workspace repeatedly based on some input. In this case the input will be the path to an XML file. This is straight forward to setup, all you need is a Files and Directories reader and a WorkspaceRunner transformer. An example of how this would look in FME Workbench below:

Example of a controller workspace

An extremely useful resource for all things FME is the FMEpedia site. Lots of examples and help doing all maaner of things with FME.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.